Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: Фиксация движения на улице (фото, frigate-integration)
- description: Фиксация движения на улице frigate
- trigger:
- - platform: state
- entity_id:
- - sensor.street_car_count
- - sensor.street_person_count
- to:
- - "1"
- - "2"
- - "3"
- - "4"
- - "5"
- condition:
- - condition: or
- conditions:
- - condition: state
- entity_id: binary_sensor.street_car_motion
- state: "on"
- - condition: state
- entity_id: binary_sensor.street_person_motion
- state: "on"
- - condition: state
- entity_id: binary_sensor.street_motion
- state: "on"
- - condition: template
- value_template: "{{states(\"person.vladimir\") != \"home\" }}"
- - condition: template
- value_template: "{{ is_state_attr(this.entity_id, \"current\",0) }}"
- action:
- - service: telegram_bot.send_photo
- data:
- target: ххххххх
- url: |
- {% if ((trigger.entity_id) == "sensor.street_car_count")%}
- http://192.168.1.6:8123{{state_attr('camera.street_car', 'entity_picture')}}
- {% elif ((trigger.entity_id) == "sensor.street_person_count")%}
- http://192.168.1.6:8123{{state_attr('camera.street_person', 'entity_picture')}}
- {% endif %}
- caption: |
- {% if ((trigger.entity_id) == "sensor.street_car_count")%}
- Машина на улице. Время обнаружения {{as_timestamp(trigger.to_state.last_updated) | timestamp_custom("%H-%M") }}
- {% elif ((trigger.entity_id) == "sensor.street_person_count")%}
- Кто-то на улице. Время обнаружения {{as_timestamp(trigger.to_state.last_updated) | timestamp_custom("%H-%M") }}
- {% endif %}
- - parallel:
- - service: camera.record
- data:
- duration: 30
- lookback: 5
- filename: >-
- /media/house-video/street/Улица_{% if ((trigger.entity_id) ==
- "sensor.street_car_count")%}машина_{% elif ((trigger.entity_id) ==
- "sensor.street_person_count")%}человек_{% endif
- %}{{as_timestamp(trigger.to_state.last_updated) |
- timestamp_custom("%d-%m-%Y_%H-%M-%S") }}.mp4
- target:
- entity_id: camera.street
- - repeat:
- count: 2
- sequence:
- - service: telegram_bot.send_photo
- data:
- target: ххххххх
- url: http://192.168.1.13:5000/api/street/latest.jpg
- caption: Текущие фото с камеры на улице.
- - delay:
- hours: 0
- minutes: 0
- seconds: 3
- milliseconds: 0
- - delay:
- hours: 0
- minutes: 0
- seconds: 50
- milliseconds: 0
- - service: telegram_bot.send_message
- data:
- message: >-
- Видеозапись движения{% if ((trigger.entity_id) ==
- "sensor.street_car_count")%} машины, обнаруженной {% elif
- ((trigger.entity_id) == "sensor.street_person_count") and
- (((trigger.to_state.state) | int) == 1)%} человека, обнаруженного {%
- elif ((trigger.entity_id) == "sensor.street_person_count") and
- (((trigger.to_state.state) | int) > 1)%} людей, обнаруженных {% endif
- %}в {{as_timestamp(trigger.to_state.last_updated) |
- timestamp_custom("%H-%M") }} часов готова.
- target: хххххххх
- inline_keyboard:
- - >-
- Посмотреть видео:/video Улица_{% if ((trigger.entity_id) ==
- "sensor.street_car_count")%}машина_{% elif ((trigger.entity_id) ==
- "sensor.street_person_count")%}человек_{% endif
- %}{{as_timestamp(trigger.to_state.last_updated) |
- timestamp_custom("%d-%m-%Y_%H-%M-%S") }}.mp4
- mode: single
Advertisement
Add Comment
Please, Sign In to add comment