Add cold day handling

This commit is contained in:
2023-01-16 16:58:41 -05:00
parent 7e95b1695b
commit 00204bdfd3
3 changed files with 41 additions and 3 deletions

View File

@ -16,18 +16,31 @@ template:
- binary_sensor:
- name: Heat Threshold
state: >
{% set high = states('sensor.pirateweather_temperature') | int %}
{% set temp = states('sensor.pirateweather_temperature') | int %}
{% set threshold = states('input_number.hot_day_threshold') | int %}
{% if high >= threshold %}
{% if temp >= 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 }}"
- binary_sensor:
- name: Cold Threshold
state: >
{% set temp = states('sensor.pirateweather_temperature') | int %}
{% set threshold = states('input_number.cold_day_threshold') | int %}
{% if temp <= threshold %}
true
{% else %}
false
{% endif %}
device_class: cold
attributes:
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
threshold: "{{ states('input_number.cold_day_threshold') | int }}"
sensor:
- platform: weatheralerts