Archived
1
0
Fork 0

weewx-wdc

This commit is contained in:
Daniel Kempkens 2022-12-22 22:57:53 +01:00
parent 1a14d21711
commit ab5b6d528a
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
5 changed files with 95 additions and 39 deletions

View file

@ -29,20 +29,36 @@ ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir --requirement requirements.txt RUN pip install --no-cache-dir --requirement requirements.txt
# Download weewx and plugins # Download weewx and plugins
RUN wget -O "${ARCHIVE}" "http://www.weewx.com/downloads/released_versions/${ARCHIVE}" &&\ RUN wget -nv -O "${ARCHIVE}" "http://www.weewx.com/downloads/released_versions/${ARCHIVE}" &&\
wget -O weewx-MQTTSubscribe.zip https://github.com/bellrichm/WeeWX-MQTTSubscribe/archive/refs/tags/v2.2.2.zip &&\ wget -nv -O weewx-MQTTSubscribe.zip https://github.com/bellrichm/WeeWX-MQTTSubscribe/archive/refs/tags/v2.2.2.zip &&\
wget -O weewx-forecast.zip https://github.com/chaunceygardiner/weewx-forecast/archive/master.zip &&\ wget -nv -O weewx-forecast.zip https://github.com/chaunceygardiner/weewx-forecast/archive/master.zip &&\
wget -O weewx-GTS.zip https://github.com/roe-dl/weewx-GTS/archive/master.zip &&\ wget -nv -O weewx-GTS.zip https://github.com/roe-dl/weewx-GTS/archive/master.zip &&\
wget -O weewx-purpleair.zip https://github.com/xslima00/weewx-purpleair/archive/refs/heads/patch-1.zip &&\ wget -nv -O weewx-purpleair.zip https://github.com/xslima00/weewx-purpleair/archive/refs/heads/patch-1.zip &&\
wget -O weewx-aqi.zip https://github.com/jonathankoren/weewx-aqi/archive/refs/tags/v1.4.zip &&\ wget -nv -O weewx-aqi.zip https://github.com/jonathankoren/weewx-aqi/archive/refs/tags/v1.4.zip &&\
wget -O weewx-wdc.zip https://github.com/Daveiano/weewx-wdc/releases/download/${WEEWX_WDC_VERSION}/weewx-wdc-${WEEWX_WDC_VERSION}.zip wget -nv -O weewx-dwd.zip https://github.com/roe-dl/weewx-DWD/archive/master.zip &&\
wget -nv -O weewx-wdc.zip https://github.com/Daveiano/weewx-wdc/releases/download/${WEEWX_WDC_VERSION}/weewx-wdc-${WEEWX_WDC_VERSION}.zip
# Extract weewx and (some) plugins # Extract weewx and (some) plugins
RUN tar --extract --gunzip --directory ${WEEWX_HOME} --strip-components=1 --file "${ARCHIVE}" &&\ RUN tar --extract --gunzip --directory ${WEEWX_HOME} --strip-components=1 --file "${ARCHIVE}" &&\
mkdir weewx-dwd && unzip weewx-dwd.zip -d weewx-dwd &&\
mkdir weewx-wdc && unzip weewx-wdc.zip -d weewx-wdc mkdir weewx-wdc && unzip weewx-wdc.zip -d weewx-wdc
# Icons
RUN wget -nv -O icons-dwd.zip "https://www.dwd.de/DE/wetter/warnungen_aktuell/objekt_einbindung/icons/wettericons_zip.zip?__blob=publicationFile&v=3" &&\
wget -nv -O warnicons-dwd.zip "https://www.dwd.de/DE/wetter/warnungen_aktuell/objekt_einbindung/icons/warnicons_nach_stufen_50x50_zip.zip?__blob=publicationFile&v=2" &&\
wget -nv -O icons-carbon.zip "https://public-images-social.s3.eu-west-1.amazonaws.com/weewx-wdc-carbon-icons.zip" &&\
mkdir -p "${WEEWX_HOME}/public_html/dwd/icons" && mkdir -p "${WEEWX_HOME}/public_html/dwd/warn_icons" &&\
unzip /tmp/icons-dwd.zip -d "${WEEWX_HOME}/public_html/dwd/icons" &&\
unzip /tmp/icons-carbon.zip -d "${WEEWX_HOME}/public_html/dwd/icons" &&\
unzip /tmp/warnicons-dwd.zip -d "${WEEWX_HOME}/public_html/dwd/warn_icons"
# Adjust (some) file content and permissions
RUN sed -i -z -e "s|PTH=\"/etc/weewx/skins/Belchertown/dwd\"|PTH=\"/home/weewx/skins/weewx-wdc/dwd\"|g" /tmp/weewx-dwd/usr/local/bin/wget-dwd &&\
sed -i -z -e "s|config = configobj.ConfigObj(\"/etc/weewx/weewx.conf\")|config = configobj.ConfigObj(\"/data/weewx.conf\")|g" /usr/local/bin/dwd-warnings &&\
chmod +x /tmp/weewx-dwd/usr/local/bin/* &&\
chown -R weewx:weewx ${WEEWX_HOME}
# weewx setup # weewx setup
RUN chown -R weewx:weewx ${WEEWX_HOME}
WORKDIR ${WEEWX_HOME} WORKDIR ${WEEWX_HOME}
RUN bin/wee_extension --install /tmp/weewx-MQTTSubscribe.zip &&\ RUN bin/wee_extension --install /tmp/weewx-MQTTSubscribe.zip &&\
bin/wee_extension --install /tmp/weewx-forecast.zip &&\ bin/wee_extension --install /tmp/weewx-forecast.zip &&\
@ -72,6 +88,8 @@ RUN apt-get update -qq -y &&\
libusb-1.0-0 \ libusb-1.0-0 \
zlib1g \ zlib1g \
libjpeg62-turbo \ libjpeg62-turbo \
cron \
wget \
gosu \ gosu \
busybox-syslogd \ busybox-syslogd \
tzdata \ tzdata \
@ -83,6 +101,7 @@ RUN apt-get update -qq -y &&\
WORKDIR ${WEEWX_HOME} WORKDIR ${WEEWX_HOME}
COPY --from=install /opt/venv /opt/venv COPY --from=install /opt/venv /opt/venv
COPY --from=install ${WEEWX_HOME} ${WEEWX_HOME} COPY --from=install ${WEEWX_HOME} ${WEEWX_HOME}
COPY --from=install /tmp/weewx-dwd/usr/local/bin/* /usr/local/bin/
COPY --chown=weewx:weewx defaults/ /defaults COPY --chown=weewx:weewx defaults/ /defaults
RUN mkdir /data && \ RUN mkdir /data && \

21
defaults/cron/dwd Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# Daten beim Deutschen Wetterdienst herunterladen
# Copyright (C) 2021 Johanna Roedenbeck
# licensed under the terms of the General Public Licens (GPL) v3
# Diese Datei ist unter /etc/cron.hourly zu speichern. Sie muss
# ausfuehrbar sein.
/usr/local/bin/wget-dwd 2>/dev/null
#/usr/local/bin/dwd-warnings 2>/dev/null >/dev/null
# Soll statt dwd-warnings dwd-cap-warnings verwendet werden,
# hier das Kommentarzeichen entfernen und dafuer eines vor
# die Zeile mit dwd-warnings setzen
/usr/local/bin/dwd-cap-warnings --weewx --resolution=city 2>/dev/null >/dev/null
# Fuer Wettervorhersagen XXXXX durch den Stationscode
# ersetzen und das Kommentarzeichen entfernen.
/usr/local/bin/dwd-mosmix --weewx --daily --hourly K1174 2>/dev/null >/dev/null
exit 0

View file

@ -39,8 +39,16 @@ http {
expires modified 120s; expires modified 120s;
} }
location ~* \.(js|css|png)$ { location ~* \.(png)$ {
expires 12h; expires 12h;
} }
location ~* \.(js|css)$ {
expires modified 1h;
}
location /dwd {
root /home/weewx/public_html/dwd;
}
} }
} }

View file

@ -34,30 +34,30 @@ SKIN_VERSION = 2.3.2
show_precip = 1 show_precip = 1
show_obvis = 0 show_obvis = 0
#[[weewx-DWD]] [[weewx-DWD]]
# show_text_forecast = True show_text_forecast = True
# text_forecast_VHDL = DWLG text_forecast_VHDL = DWLG
# dwd_link = https://www.dwd.de/DE/wetter/wetterundklima_vorort/sachsen/sac_node.html dwd_link = https://www.dwd.de/DE/wetter/wetterundklima_vorort/nordrhein-westfalen/nrw_node.html
# show_pressure_map = True show_pressure_map = True
# show_warning_map = True show_warning_map = True
# warning_map_filename = 'SchilderLZ.jpg' warning_map_filename = 'SchilderLZ.jpg'
# show_text_warnings = True show_text_warnings = True
# show_warnings_on_front = XXX show_warnings_on_front = 'HS'
# show_forecast = True show_forecast = True
# mosmix_id = XXXX mosmix_id = K1174
# [[[forecast_table_settings]]] [[[forecast_table_settings]]]
# show_hourly = 1 show_hourly = 1
# show_date = 1 show_date = 1
# show_outlook = 1 show_outlook = 1
# show_temp = 1 show_temp = 1
# show_dewpoint = 1 show_dewpoint = 1
# show_pressure = 1 show_pressure = 1
# show_wind= 1 show_wind= 1
# show_pop = 1 show_pop = 1
# show_precip = 1 show_precip = 1
# show_cloud_cover = 1 show_cloud_cover = 1
# show_sun_dur = 1 show_sun_dur = 1
# carbon_icons = 0 carbon_icons = 1
[DisplayOptions] [DisplayOptions]
layout = 'alternative' layout = 'alternative'
@ -293,8 +293,8 @@ SKIN_VERSION = 2.3.2
[[[day]]] [[[day]]]
template = index.html.tmpl template = index.html.tmpl
# [[[yesterday]]] [[[yesterday]]]
# template = yesterday.html.tmpl template = yesterday.html.tmpl
[[[week]]] [[[week]]]
template = week.html.tmpl template = week.html.tmpl
@ -318,9 +318,9 @@ SKIN_VERSION = 2.3.2
#[[[about]]] #[[[about]]]
#template = about.html.tmpl #template = about.html.tmpl
#title = About #title = About
#[[[DWD]]] [[[DWD]]]
#template = dwd.html.tmpl template = dwd.html.tmpl
#title = Vorhersage vom DWD title = Vorhersage vom DWD
[Units] [Units]
[[TimeFormats]] [[TimeFormats]]
@ -337,7 +337,7 @@ SKIN_VERSION = 2.3.2
[CopyGenerator] [CopyGenerator]
copy_once = dist/main.js, dist/main.css, plotly-custom-build.min.js, favicon.ico, manifest.json, icon-192x192.png, icon-256x256.png, icon-384x384.png, icon-512x512.png, service-worker.js, offline.html copy_once = dist/main.js, dist/main.css, plotly-custom-build.min.js, favicon.ico, manifest.json, icon-192x192.png, icon-256x256.png, icon-384x384.png, icon-512x512.png, service-worker.js, offline.html
# copy_always = copy_always = dwd/SchilderLZ.jpg, dwd/bwk_bodendruck_weu_ana.png, dwd/bwk_bodendruck_na_ana.png
[Generators] [Generators]
generator_list = weewx.cheetahgenerator.CheetahGenerator, weewx.reportengine.CopyGenerator generator_list = weewx.cheetahgenerator.CheetahGenerator, weewx.reportengine.CopyGenerator

View file

@ -26,6 +26,14 @@ if [ "$(id -u)" = 0 ]; then
nginx -c /defaults/nginx.conf nginx -c /defaults/nginx.conf
fi fi
# setup cron
if [ -e /data/cron/dwd ]; then
cp /data/cron/dwd /etc/cron.hourly/
else
cp /defaults/cron/dwd /etc/cron.hourly/
fi
chmod +x /etc/cron.hourly/*
# skin config: WDC # skin config: WDC
rm -f ./skins/weewx-wdc/skin.conf rm -f ./skins/weewx-wdc/skin.conf
if [ -e /data/skin-wdc/skin.conf ]; then if [ -e /data/skin-wdc/skin.conf ]; then