Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- automation:
- - alias: 'Alert smoke detected in the kitchen'
- trigger:
- - platform: state
- entity_id: binary_sensor.kitchen_smoke_detector
- from: 'off'
- to: 'on'
- action:
- - service: script.turn_on
- entity_id: script.smoke_visual_alarm
- - service: script.turn_on
- entity_id: script.smoke_sound_alarm
- script:
- smoke_visual_alarm:
- sequence:
- - alias: 'smoke visual alarm repeat'
- repeat:
- while:
- - condition: state
- entity_id: binary_sensor.kitchen_smoke_detector
- state: 'on'
- - condition: template
- value_template: "{{ repeat.index <= 20 }}"
- sequence:
- - service: light.turn_on
- entity_id: light.kitchen_led_strip
- data:
- rgb_color: [255,0,0]
- brightness: 255
- flash: long
- - delay:
- seconds: 15
- smoke_sound_alarm:
- mode: restart
- sequence:
- - service: media_player.volume_set
- data:
- entity_id: media_player.sonos_1
- volume_level: 1
- - alias: 'smoke sound alarm repeat'
- repeat:
- while:
- - condition: state
- entity_id: binary_sensor.kitchen_smoke_detector
- state: 'on'
- - condition: template
- value_template: "{{ repeat.index <= 20 }}"
- sequence:
- - service: media_player.play_media
- data_template:
- entity_id: media_player.sonos_1
- media_content_id: http://192.168.1.20:8123/local/sounds/alarm/alarm_sound.mp3
- media_content_type: music
- - delay:
- seconds: 9
- - service: media_player.play_media
- data_template:
- entity_id: media_player.sonos_1
- media_content_id: http://192.168.1.20:8123/local/sounds/alarm/info_smoke.mp3
- media_content_type: music
- - delay:
- seconds: 4
- smoke_alarm_cancel:
- alias: 'smoke alarm cancel'
- mode: restart
- sequence:
- - service: homeassistant.turn_off
- data:
- entity_id: script.smoke_visual_alarm
- - delay:
- seconds: 1
- - service: light.turn_off
- entity_id: light.kitchen_led_strip
- - service: homeassistant.turn_off
- data:
- entity_id: script.smoke_sound_alarm
- - service: media_player.media_stop
- entity_id: media_player.sonos_1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement