Improvements to hot weather detection

This commit is contained in:
2023-05-31 12:26:22 -04:00
parent f1718ff545
commit 89013d70b9
3 changed files with 41 additions and 2 deletions

View File

@ -242,3 +242,17 @@ input_number:
step: 1 step: 1
unit_of_measurement: °F unit_of_measurement: °F
icon: mdi:thermometer icon: mdi:thermometer
hot_overnight_threshold:
name: Hot Overnight Threshold
min: 40
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
extended_heat_threshold:
name: Extended Heat Threshold
min: 70
max: 100
step: 1
unit_of_measurement: °F
icon: mdi:thermometer

View File

@ -87,6 +87,30 @@ template:
attributes: attributes:
current_temp: "{{ state_attr('weather.iron_nerd_weather_station','temperature') | int }}" current_temp: "{{ state_attr('weather.iron_nerd_weather_station','temperature') | int }}"
threshold: "{{ states('input_number.wind_chill_threshold') | int }}" threshold: "{{ states('input_number.wind_chill_threshold') | int }}"
- name: Heat Warning
unique_id: 02b8020a-4fa1-4489-abea-bfadf82ec7e5
state: >
{% set day = states('sensor.todays_high_temp') | int %}
{% set night = states('sensor.overnight_lowest_temperature') | int %}
{% set dayThreshold = states('input_number.extended_heat_threshold') | int %}
{% set nightThreshold = states('input_number.hot_overnight_threshold') | int %}
{% set hotDayThreshold = states('input_number.hot_day_threshold') | int %}
{{ (day >= dayThreshold and night >= nightThreshold) or day >= hotDayThreshold }}
device_class: heat
attributes:
trigger: >
{% set day = states('sensor.todays_high_temp') | int %}
{% set night = states('sensor.overnight_lowest_temperature') | int %}
{% set dayThreshold = states('input_number.extended_heat_threshold') | int %}
{% set nightThreshold = states('input_number.hot_overnight_threshold') | int %}
{% set hotDayThreshold = states('input_number.hot_day_threshold') | int %}
{% if day >= dayThreshold and night >= nightThreshold %}
Extended Threat
{% elif day >= hotDayThreshold %}
Hot Day
{% else %}
No Trigger
{% endif %}
- name: "Lightning Warning" - name: "Lightning Warning"
unique_id: edaddfc4-f7f0-4d75-aada-a2c588afe029 unique_id: edaddfc4-f7f0-4d75-aada-a2c588afe029
state: "{{ states('sensor.blitzortung_lightning_counter') | int > 0 }}" state: "{{ states('sensor.blitzortung_lightning_counter') | int > 0 }}"

View File

@ -484,8 +484,9 @@ script:
{{ as_timestamp(this_weekday(3)) | timestamp_custom('%Y-%m-%d') }} {{ as_timestamp(this_weekday(3)) | timestamp_custom('%Y-%m-%d') }}
{% endif %} {% endif %}
- if: - if:
- condition: template - condition: state
value_template: "{{ states('sensor.todays_high_temp') | int >= states('input_number.hot_day_threshold') | int }}" entity_id: binary_sensor.heat_warning
state: 'on'
then: then:
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target: