Automation Example - AC
3 years ago in Plain Text
- id: '1598620672731'
alias: Automation Example - AC
description: ''
trigger:
- device_id: 21344e46f93c4ff4afd28a6e385579d7
domain: binary_sensor
entity_id: binary_sensor.fridge_door
for:
hours: 0
minutes: 3
seconds: 0
platform: device
type: opened
- device_id: b7125ee6981346319aed928466115567
domain: binary_sensor
entity_id: binary_sensor.freezer_door
for:
hours: 0
minutes: 3
seconds: 0
platform: device
type: opened
condition:
- condition: state
entity_id: switch.family_room_box_fan_left
state: 'on'
action:
- repeat:
count: '2'
sequence:
- data_template:
entity_id: '{% if freezer in trigger.trigger.entity_id %} media_player.freezer
{% elif fridge in trigger.trigger.entity_id %} media_player.freezer {%
else %} media_player.all_devices_group {% endif %}'
message: "{{ [\n \"Please turn off fan or close window\",\n \"Woah nellie\
\ close that window the AC is on\",\n \"We're not cooling the world close\
\ the window\",\n \"Please close the window\",\n \"The AC is on close\
\ the window\",\n \"We're not millionaires close that window\"] | random\
\ }}"
service: tts.cloud_say
- delay: 00:01:00
- data_template:
entity_id: '{% if freezer in trigger.trigger.entity_id %} media_player.freezer
{% elif fridge in trigger.trigger.entity_id %} media_player.freezer {% else
%} media_player.all_devices_group {% endif %}'
message: "{{ [\n \"Last chance, close the window\",\n \"I warned you\",\n \"\
That's it\",\n ] | random }}"
service: tts.cloud_say
- condition: template
value_template: '''{{ trigger.to_state.state == ''on'' }}'''
- data: {}
entity_id: switch.bedroom_box_fan_side, switch.family_room_box_fan_left, switch.family_room_box_fan_right
service: switch.turn_off
mode: single