From 35c403ed64660af3cf210828251ffea3621f7f51 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Sat, 9 Oct 2021 22:14:56 +1100 Subject: [PATCH] [wunderground_] Allow to disable alerts with `env.alerts no` Signed-off-by: Olivier Mehani --- plugins/weather/wunderground_ | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/weather/wunderground_ b/plugins/weather/wunderground_ index 192c8f54..8191a9fd 100755 --- a/plugins/weather/wunderground_ +++ b/plugins/weather/wunderground_ @@ -26,6 +26,7 @@ the usual unit for precipitation. env.units metric # optional, this is the default env.base_url # optional, default to https://api.weather.com/v2/pws/observations/current env.connect_timeout 1 # optional, amount to wait for requests, in seconds + env.alerts yes # optional, controls whether to report alerts, enabled by default Alternatively, the station_id can be encoded in the name of the symlink as wunderground_STATIONID (e.g., wundergound_KCASANFR1708). This allows to monitor @@ -78,6 +79,9 @@ API_KEY=${api_key:-6532d6454b8aa370768e63d6ba5a832e} UNITS=${units:-metric} BASE_URL=${base_url:-https://api.weather.com/v2/pws/observations/current} CONNECT_TIMEOUT=${connect_timeout:-1} +if [ "${alerts:-yes}" = yes ]; then + USE_ALERTS=yes +fi UNITS_ARG='&units=m' DISTANCE_UNIT='m' @@ -203,8 +207,10 @@ dewpt.info Temperature to which air must be cooled to become saturated with wate windChill.label Wind chill windChill.info Represent the lowering of body temperature due to the passing-flow of lower-temperature air. Wind chill numbers are always lower than the air temperature for values where the formula is valid. When the apparent temperature is higher than the air temperature, the heat index is used instead. +${USE_ALERTS:+ windChill.warning ${WIND_CHILL_CAUTION} windChill.critical ${WIND_CHILL_DANGER} +} windChillCaution.label Wind chill Caution windChillCaution.info Danger of frostbite windChillCaution.colour 5358f6 @@ -216,8 +222,10 @@ windChillDanger.line ${WIND_CHILL_DANGER} heatIndex.label Heat index heatIndex.info Index that combines air temperature and relative humidity, in shaded areas, to posit a human-perceived equivalent temperature, as how hot it would feel if the humidity were some other value in the shade. +${USE_ALERTS:+ heatIndex.warning ${HEAT_INDEX_EXTREME_CAUTION} heatIndex.critical ${HEAT_INDEX_DANGER} +} heatIndexCaution.label Heat index Caution heatIndexCaution.info Fatigue is possible with prolonged exposure and activity. Continuing activity could result in heat cramps. heatIndexCaution.colour ffff66 @@ -243,8 +251,10 @@ graph_args -l 0 graph_vlabel UV index uv.label UV index uv.min 0 +${USE_ALERTS:+ uv.warning 5 uv.critical 7 +} moderate.label Moderate moderate.info Stay in shade near midday when the Sun is strongest. If outdoors, wear Sun protective clothing, a wide-brimmed hat, and UV-blocking sunglasses. Generously apply broad spectrum SPF 30+ sunscreen every 1.5 hours, even on cloudy days, and after swimming or sweating. Bright surfaces, such as sand, water, and snow, will increase UV exposure. moderate.colour fff300