Advertisement
Guest User

Untitled

a guest
Dec 1st, 2020
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. automation:
  2. - alias: 'Alert smoke detected in the kitchen'
  3. trigger:
  4. - platform: state
  5. entity_id: binary_sensor.kitchen_smoke_detector
  6. from: 'off'
  7. to: 'on'
  8. action:
  9. - service: script.turn_on
  10. entity_id: script.smoke_visual_alarm
  11. - service: script.turn_on
  12. entity_id: script.smoke_sound_alarm
  13.  
  14. script:
  15. smoke_visual_alarm:
  16. sequence:
  17. - alias: 'smoke visual alarm repeat'
  18. repeat:
  19. while:
  20. - condition: state
  21. entity_id: binary_sensor.kitchen_smoke_detector
  22. state: 'on'
  23. - condition: template
  24. value_template: "{{ repeat.index <= 20 }}"
  25. sequence:
  26. - service: light.turn_on
  27. entity_id: light.kitchen_led_strip
  28. data:
  29. rgb_color: [255,0,0]
  30. brightness: 255
  31. flash: long
  32. - delay:
  33. seconds: 15
  34.  
  35. smoke_sound_alarm:
  36. mode: restart
  37. sequence:
  38. - service: media_player.volume_set
  39. data:
  40. entity_id: media_player.sonos_1
  41. volume_level: 1
  42. - alias: 'smoke sound alarm repeat'
  43. repeat:
  44. while:
  45. - condition: state
  46. entity_id: binary_sensor.kitchen_smoke_detector
  47. state: 'on'
  48. - condition: template
  49. value_template: "{{ repeat.index <= 20 }}"
  50. sequence:
  51. - service: media_player.play_media
  52. data_template:
  53. entity_id: media_player.sonos_1
  54. media_content_id: http://192.168.1.20:8123/local/sounds/alarm/alarm_sound.mp3
  55. media_content_type: music
  56. - delay:
  57. seconds: 9
  58. - service: media_player.play_media
  59. data_template:
  60. entity_id: media_player.sonos_1
  61. media_content_id: http://192.168.1.20:8123/local/sounds/alarm/info_smoke.mp3
  62. media_content_type: music
  63. - delay:
  64. seconds: 4
  65.  
  66. smoke_alarm_cancel:
  67. alias: 'smoke alarm cancel'
  68. mode: restart
  69. sequence:
  70. - service: homeassistant.turn_off
  71. data:
  72. entity_id: script.smoke_visual_alarm
  73. - delay:
  74. seconds: 1
  75. - service: light.turn_off
  76. entity_id: light.kitchen_led_strip
  77. - service: homeassistant.turn_off
  78. data:
  79. entity_id: script.smoke_sound_alarm
  80. - service: media_player.media_stop
  81. entity_id: media_player.sonos_1
  82.  
  83.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement