From 7e95b1695b39c4cb693658f5f4c926b64a95ad78 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 16 Jan 2023 16:45:50 -0500 Subject: [PATCH] Add binary sensor for heat threshold --- packages/custom_weather.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/custom_weather.yaml b/packages/custom_weather.yaml index 97eb634..70bbacf 100644 --- a/packages/custom_weather.yaml +++ b/packages/custom_weather.yaml @@ -12,6 +12,23 @@ weather: attribution_template: "Weather data from Iron Nerd's custom weather station template" ozone_template: "{{ states('sensor.pirateweather_ozone') | float }}" +template: + - binary_sensor: + - name: Heat Threshold + state: > + {% set high = states('sensor.pirateweather_temperature') | int %} + {% set threshold = states('input_number.hot_day_threshold') | int %} + {% if high >= threshold %} + true + {% else %} + false + {% endif %} + delay_off: '00:30:00' + device_class: heat + attributes: + current_temp: "{{ states('sensor.pirateweather_temperature') | int }}" + threshold: "{{ states('input_number.hot_day_threshold') | int }}" + sensor: - platform: weatheralerts state: OH