Advertisement
y2kbug

Untitled

Aug 22nd, 2023
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. alias: Frigate Telegram Notification
  2. description: ""
  3. trigger:
  4. - platform: mqtt
  5. topic: frigate/events
  6. payload: reolink-entrance
  7. value_template: "{{ value_json['after']['camera'] }}"
  8. condition:
  9. - condition: template
  10. value_template: "{{ trigger.payload_json['type'] != 'end' }}"
  11. action:
  12. - choose:
  13. - conditions:
  14. - condition: state
  15. entity_id: input_boolean.home_occupancy
  16. state: "on"
  17. sequence:
  18. - service: rest_command.telegram_send_photo
  19. data:
  20. token: TELEGRAM_TOKEN
  21. chat_id: TELEGRAM_CHAT_ID
  22. disable_notification: 1
  23. url: >-
  24. https://home-assistant.domain/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/snapshot.jpg
  25. - repeat:
  26. sequence:
  27. - wait_for_trigger:
  28. - platform: mqtt
  29. topic: frigate/events
  30. payload: "{{ trigger.payload_json['after']['id'] }}"
  31. value_template: "{{ value_json['after']['id'] }}"
  32. timeout: 180
  33. continue_on_timeout: false
  34. - condition: template
  35. value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}"
  36. - delay:
  37. hours: 0
  38. minutes: 0
  39. seconds: 10
  40. milliseconds: 0
  41. - service: rest_command.telegram_send_video
  42. data:
  43. token: TELEGRAM_TOKEN
  44. chat_id: TELEGRAM_CHAT_ID
  45. disable_notification: 1
  46. width: 2560
  47. height: 1440
  48. url: >-
  49. https://home-assistant.domain/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/reolink-entrance/clip.mp4
  50. until:
  51. - condition: template
  52. value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}"
  53. - conditions:
  54. - condition: state
  55. entity_id: input_boolean.home_occupancy
  56. state: "off"
  57. sequence:
  58. - service: rest_command.telegram_send_photo
  59. data:
  60. token: TELEGRAM_TOKEN
  61. chat_id: TELEGRAM_CHAT_ID
  62. url: >-
  63. https://home-assistant.domain/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/snapshot.jpg
  64. - repeat:
  65. sequence:
  66. - wait_for_trigger:
  67. - platform: mqtt
  68. topic: frigate/events
  69. payload: "{{ trigger.payload_json['after']['id'] }}"
  70. value_template: "{{ value_json['after']['id'] }}"
  71. timeout: 180
  72. continue_on_timeout: false
  73. - condition: template
  74. value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}"
  75. - delay:
  76. hours: 0
  77. minutes: 0
  78. seconds: 10
  79. milliseconds: 0
  80. - service: rest_command.telegram_send_video
  81. data:
  82. token: TELEGRAM_TOKEN
  83. chat_id: TELEGRAM_CHAT_ID
  84. width: 2560
  85. height: 1440
  86. url: >-
  87. https://home-assistant.domain/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/reolink-entrance/clip.mp4
  88. until:
  89. - condition: template
  90. value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}"
  91. mode: single
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement