Caldin-Maldin

фото, frigate

Jul 20th, 2023 (edited)
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 KB | None | 0 0
  1. alias: Фиксация движения на улице (фото, frigate-integration)
  2. description: Фиксация движения на улице frigate
  3. trigger:
  4. - platform: state
  5. entity_id:
  6. - sensor.street_car_count
  7. - sensor.street_person_count
  8. to:
  9. - "1"
  10. - "2"
  11. - "3"
  12. - "4"
  13. - "5"
  14. condition:
  15. - condition: or
  16. conditions:
  17. - condition: state
  18. entity_id: binary_sensor.street_car_motion
  19. state: "on"
  20. - condition: state
  21. entity_id: binary_sensor.street_person_motion
  22. state: "on"
  23. - condition: state
  24. entity_id: binary_sensor.street_motion
  25. state: "on"
  26. - condition: template
  27. value_template: "{{states(\"person.vladimir\") != \"home\" }}"
  28. - condition: template
  29. value_template: "{{ is_state_attr(this.entity_id, \"current\",0) }}"
  30. action:
  31. - service: telegram_bot.send_photo
  32. data:
  33. target: ххххххх
  34. url: |
  35. {% if ((trigger.entity_id) == "sensor.street_car_count")%}
  36. http://192.168.1.6:8123{{state_attr('camera.street_car', 'entity_picture')}}
  37. {% elif ((trigger.entity_id) == "sensor.street_person_count")%}
  38. http://192.168.1.6:8123{{state_attr('camera.street_person', 'entity_picture')}}
  39. {% endif %}
  40. caption: |
  41. {% if ((trigger.entity_id) == "sensor.street_car_count")%}
  42. Машина на улице. Время обнаружения {{as_timestamp(trigger.to_state.last_updated) | timestamp_custom("%H-%M") }}
  43. {% elif ((trigger.entity_id) == "sensor.street_person_count")%}
  44. Кто-то на улице. Время обнаружения {{as_timestamp(trigger.to_state.last_updated) | timestamp_custom("%H-%M") }}
  45. {% endif %}
  46. - parallel:
  47. - service: camera.record
  48. data:
  49. duration: 30
  50. lookback: 5
  51. filename: >-
  52. /media/house-video/street/Улица_{% if ((trigger.entity_id) ==
  53. "sensor.street_car_count")%}машина_{% elif ((trigger.entity_id) ==
  54. "sensor.street_person_count")%}человек_{% endif
  55. %}{{as_timestamp(trigger.to_state.last_updated) |
  56. timestamp_custom("%d-%m-%Y_%H-%M-%S") }}.mp4
  57. target:
  58. entity_id: camera.street
  59. - repeat:
  60. count: 2
  61. sequence:
  62. - service: telegram_bot.send_photo
  63. data:
  64. target: ххххххх
  65. url: http://192.168.1.13:5000/api/street/latest.jpg
  66. caption: Текущие фото с камеры на улице.
  67. - delay:
  68. hours: 0
  69. minutes: 0
  70. seconds: 3
  71. milliseconds: 0
  72. - delay:
  73. hours: 0
  74. minutes: 0
  75. seconds: 50
  76. milliseconds: 0
  77. - service: telegram_bot.send_message
  78. data:
  79. message: >-
  80. Видеозапись движения{% if ((trigger.entity_id) ==
  81. "sensor.street_car_count")%} машины, обнаруженной {% elif
  82. ((trigger.entity_id) == "sensor.street_person_count") and
  83. (((trigger.to_state.state) | int) == 1)%} человека, обнаруженного {%
  84. elif ((trigger.entity_id) == "sensor.street_person_count") and
  85. (((trigger.to_state.state) | int) > 1)%} людей, обнаруженных {% endif
  86. %}в {{as_timestamp(trigger.to_state.last_updated) |
  87. timestamp_custom("%H-%M") }} часов готова.
  88. target: хххххххх
  89. inline_keyboard:
  90. - >-
  91. Посмотреть видео:/video Улица_{% if ((trigger.entity_id) ==
  92. "sensor.street_car_count")%}машина_{% elif ((trigger.entity_id) ==
  93. "sensor.street_person_count")%}человек_{% endif
  94. %}{{as_timestamp(trigger.to_state.last_updated) |
  95. timestamp_custom("%d-%m-%Y_%H-%M-%S") }}.mp4
  96. mode: single
  97.  
Advertisement
Add Comment
Please, Sign In to add comment