Better way of dealing with rain alerts

This commit is contained in:
2023-05-02 17:32:27 -04:00
parent c2b79c72a7
commit 7adf7e4e20
2 changed files with 8 additions and 18 deletions

View File

@ -93,19 +93,6 @@ template:
device_class: safety device_class: safety
attributes: attributes:
current_strikes: "{{ states('sensor.blitzortung_lightning_counter') | int }}" current_strikes: "{{ states('sensor.blitzortung_lightning_counter') | int }}"
- name: Precipitation
unique_id: 2423f8c6-f9ce-4063-a7f8-30dc260d1376
state: "{{ states('weather.iron_nerd_weather_station') in ['rainy','thunderstorm','lightning','sleet','snow','snowy','hail','tornado'] }}"
attributes:
type_of_precipitation: >
{% if states('weather.iron_nerd_weather_station') in ['rainy','thunderstorm','lightning','hail','tornado'] %}
Rain
{% elif states('weather.iron_nerd_weather_station') in ['sleet','snow','snowy'] %}
Snow
{% else %}
N/A
{% endif %}
icon: mdi:water
sensor: sensor:
- platform: weatheralerts - platform: weatheralerts

View File

@ -1545,8 +1545,11 @@ automation:
alias: Rain Window Warning alias: Rain Window Warning
trigger: trigger:
- platform: state - platform: state
entity_id: binary_sensor.precipitation entity_id: sensor.pirateweather_precip
to: 'on' from: 'none'
not_to:
- unavailable
- unknown
condition: condition:
- condition: state - condition: state
entity_id: binary_sensor.windows entity_id: binary_sensor.windows
@ -1563,13 +1566,13 @@ automation:
data: data:
who: everywhere who: everywhere
message: "It is raining and there are windows open in the house. Please close them!" message: "It is raining and there are windows open in the house. Please close them!"
- wait_template: "{{ is_state('binary_sensor.windows','off') or is_state('binary_sensor.precipitation','off') }}" - wait_template: "{{ is_state('binary_sensor.windows','off') or is_state('sensor.pirateweather_precip','none') }}"
timeout: "00:15:00" timeout: "00:15:00"
continue_on_timeout: true continue_on_timeout: true
- choose: - choose:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_state('binary_sensor.windows','off') and is_state('binary_sensor.precipitation','on') }}" value_template: "{{ is_state('binary_sensor.windows','off') and states('sensor.pirateweather_precip') not in ['none'] }}"
sequence: sequence:
- service: script.text_notify - service: script.text_notify
data: data:
@ -1583,7 +1586,7 @@ automation:
message: "Windows are now closed. Thank you, and enjoy your dry house." message: "Windows are now closed. Thank you, and enjoy your dry house."
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_state('binary_sensor.precipitation','off') }}" value_template: "{{ is_state('sensor.pirateweather_precip','none') }}"
sequence: sequence:
- service: script.text_notify - service: script.text_notify
data: data: