Improvements to rain window alert automation

This commit is contained in:
2023-11-15 17:58:05 -05:00
parent 017384e184
commit 4de0dc196e

View File

@ -2948,44 +2948,47 @@
alias: Windows are open alias: Windows are open
action: action:
- variables: - variables:
porch: '{{ true if states(''sensor.windows_open'') == ''1'' and is_state(''binary_sensor.front_window_1'',''on'') porch: "{% set windows = states('sensor.windows_open') | int %} {% set front
else false }}' = states('sensor.front_windows_open') | int %} {% if windows == front %}\n
message: "{% if porch == true %}\n It is raining and a window by the porch \ true\n{% else %}\n false\n{% endif %}"
message: "{% if porch == 'true' %}\n It is raining and a window by the porch
is open. This is generally acceptable, but please close it if the wind is is open. This is generally acceptable, but please close it if the wind is
blowing in.\n{% else %}\n It is raining and there are windows open in the blowing in.\n{% else %}\n It is raining and there are windows open in the
house. Please close them!\n{% endif %}\n" house. Please close them!\n{% endif %}\n"
alias: Define variables alias: Define variables
- service: script.text_notify - parallel:
data: - service: script.text_notify
type: alert data:
who: all type: alert
title: WINDOWS ARE OPEN! who: all
message: '{{ message }}' title: WINDOWS ARE OPEN!
tag: rain-window-warning message: '{{ message }}'
alias: Send text notification tag: rain-window-warning
- service: script.living_room_lights_alert alias: Send text notification
data: - service: script.speech_engine
type: blue data:
duration: 10 who: everywhere
alias: Light alert in living room type: weather
- if: message: '{{ message }}'
- condition: state alias: TTS notification
entity_id: binary_sensor.basement_occupied - service: script.living_room_lights_alert
state: 'on'
alias: Basement is occupied
then:
- service: script.basement_lights_alert
data: data:
type: blue type: blue
duration: 10 duration: 10
alias: Light alert in basement alias: Light alert in living room
alias: Light alert in basement, if occupied - if:
- service: script.speech_engine - condition: state
data: entity_id: binary_sensor.basement_occupied
who: everywhere state: 'on'
type: weather alias: Basement is occupied
message: '{{ message }}' then:
alias: TTS notification - service: script.basement_lights_alert
data:
type: blue
duration: 10
alias: Light alert in basement
alias: Light alert in basement, if occupied
alias: Send the various alerts
- wait_template: '{{ is_state(''binary_sensor.windows'',''off'') or is_state(''binary_sensor.raining'',''off'') - wait_template: '{{ is_state(''binary_sensor.windows'',''off'') or is_state(''binary_sensor.raining'',''off'')
}}' }}'
timeout: 00:15:00 timeout: 00:15:00