View difference between Paste ID: t8yDJcrh and 1BuuKx8f
SHOW: | | - or go back to the newest paste.
1
#Notify when windows are open
2
automation:
3
  - alias: AC on with open window - Living Room
4
    trigger:
5
      platform: state
6
      entity_id: input_boolean.ac_damper_living_room
7
      from: 'off'
8
      to: 'on'
9
      for:
10
        seconds: '60'
11
    condition:
12
      condition: or
13
      conditions:
14
        - condition: state
15
          entity_id: binary_sensor.balcony_window
16
          state: 'on'
17
        - condition: state
18
          entity_id: binary_sensor.bathroom_door
19
          state: 'on'
20
    action:
21
      - service: tts.google_translate_say
22
        data_template:
23
          entity_id: media_player.all_speakers
24
          message: >
25
            {% set balcony_window = is_state("binary_sensor.balcony_window", "on") -%}
26
            {% set bathroom_door = is_state("binary_sensor.bathroom_door", "on") -%}
27
            {% set both = (balcony_window and bathroom_door) %}
28
            You turned on the Living Room AC, but the {{ 'balcony window' if balcony_window }}{{ ' and ' if both }}{{ 'bathroom door' if bathroom_door }} {{'are' if both else 'is'}} open. You might want to close {{ 'them' if both else 'it' }} :)