diff --git a/.env.example b/.env.example index af5cb5d..b9beabf 100644 --- a/.env.example +++ b/.env.example @@ -47,6 +47,10 @@ WEEWX_WEEK_START=0 # Options: 'us' (Fahrenheit, inches, etc.), 'metric' (Celsius, mm, etc.), 'metricwx' (meteorological metric) WEEWX_UNIT_SYSTEM=metric +# Custom unit for pressure group - defaults for metric mbar +# Options: inHg, mbar, hPa, kPa +WEEWX_PRESSURE_UNIT = mbar + # Language and Localization # Language code for WeeWX interface (en, de, fr, es, it, etc.) WEEWX_LANGUAGE=en diff --git a/docker-compose.yml b/docker-compose.yml index ce1aa79..a8bbf6b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: context: . dockerfile: Dockerfile.init volumes: - - weewx_data:/data + - /opt/weewx:/data environment: - PATH=/opt/venv/bin:/usr/local/bin:/usr/bin:/bin - PIP_TARGET=/data/lib/python/site-packages @@ -25,6 +25,7 @@ services: - WEEWX_RAIN_YEAR_START=${WEEWX_RAIN_YEAR_START:-1} - WEEWX_WEEK_START=${WEEWX_WEEK_START:-0} - WEEWX_UNIT_SYSTEM=${WEEWX_UNIT_SYSTEM:-metric} + - WEEWX_PRESSURE_UNIT=${WEEWX_PRESSURE_UNIT:-mbar} - WEEWX_LANGUAGE=${WEEWX_LANGUAGE:-en} - WEEWX_TIMEZONE=${WEEWX_TIMEZONE:-} # Extension configuration @@ -48,7 +49,7 @@ services: weewx-init: condition: service_completed_successfully volumes: - - weewx_data:/data + - /opt/weewx:/data environment: - GW1000_IP=${GW1000_IP:-192.168.1.10} restart: unless-stopped @@ -62,7 +63,7 @@ services: ports: - "${NGINX_PORT:-8080}:80" volumes: - - weewx_data:/data:ro + - /opt/weewx:/data:ro command: > sh -c " cp /data/nginx/nginx.conf /etc/nginx/nginx.conf && diff --git a/init/configure-weewx.sh b/init/configure-weewx.sh index 062b1a1..59adfe6 100755 --- a/init/configure-weewx.sh +++ b/init/configure-weewx.sh @@ -62,6 +62,18 @@ if [ -n "$WEEWX_LANGUAGE" ] && [ "$WEEWX_LANGUAGE" != "en" ]; then /init/weewx_config_api.py set-value "[StdReport][Defaults]" "lang" "$WEEWX_LANGUAGE" fi +# If env variable for custom pressure unit set - apply config +if [ -n "$WEEWX_PRESSURE_UNIT" ]; then + + echo "Removing [StdReport][Defaults][Units][Groups]" + /init/weewx_config_api.py remove-section "[StdReport][Defaults][Units][Groups]" + echo "Recreating clean [StdReport][Defaults][Units][Groups]" + /init/weewx_config_api.py create-section "[StdReport][Defaults][Units][Groups]" + echo "Applying custom pressure unit: $WEEWX_PRESSURE_UNIT" + /init/weewx_config_api.py set-value "[StdReport][Defaults][Units][Groups]" "unused" "unused" + /init/weewx_config_api.py set-value "[StdReport][Defaults][Units][Groups]" "group_pressure" "$WEEWX_PRESSURE_UNIT" +fi + # Handle station_url (ConfigObj handles both commented and uncommented cases) if [ -n "$WEEWX_STATION_URL" ]; then echo "Setting station URL: $WEEWX_STATION_URL" diff --git a/init/extensions.d/belchertown/2_configure.sh b/init/extensions.d/belchertown/2_configure.sh index b032d65..89657af 100755 --- a/init/extensions.d/belchertown/2_configure.sh +++ b/init/extensions.d/belchertown/2_configure.sh @@ -58,7 +58,8 @@ configure_belchertown_options() { /init/weewx_config_api.py remove-section "[StdReport][Belchertown][Extras]" fi /init/weewx_config_api.py create-section "[StdReport][Belchertown][Extras]" - + + # Set Belchertown Extras options (for manifest and site title) /init/weewx_config_api.py set-multiple-values "[StdReport][Belchertown][Extras]" \ "site_title=$WEEWX_LOCATION" \