Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: Frigate. Уведомления Лицо из Frigate
- description: ""
- triggers:
- - trigger: mqtt
- topic: frigate/tracked_object_update
- - trigger: mqtt
- topic: test/tracked_object_update
- conditions:
- - condition: template
- value_template: "{{ trigger.payload_json['type'] == 'face'}}"
- actions:
- - variables:
- name: "{{ trigger.payload_json['name'] }}"
- type: "{{ trigger.payload_json['type'] }}"
- score: "{{ (trigger.payload_json['score'] | float(0) * 100) | int(0) }}"
- id: "{{ trigger.payload_json['id'] }}"
- datetime: >-
- {{ trigger.payload_json['timestamp'] | timestamp_custom('%Y-%m-%d
- %H:%M:%S') }}
- camera: "{{ trigger.payload_json['camera'] }}"
- ip_base_url: http://192.168.1.130:8123/api/frigate/notifications/
- alias: Определение переменных из MQTT frigate events
- - alias: type == face && != None (При распознавании лица)
- if:
- - alias: Если это лицо
- condition: template
- value_template: "{{ type == 'face' }}"
- - alias: Если name != None
- condition: template
- value_template: "{{ name != None }}"
- - alias: Условие для запрета отправки дублей
- condition: template
- value_template: "{{ id != states('input_text.frigate_face_id_event_detected') }}"
- then:
- - action: telegram_bot.send_message
- metadata: {}
- data:
- parse_mode: html
- message: |-
- Найден: <u>{{name}}</u> на {{score}}% <pre>camera: {{camera}}
- Дата: {{ datetime }}
- id: {{id}}</pre>
- target: "{{ target }}"
- enabled: true
- - alias: Если Dmitry или Nadezda > 90%
- if:
- - condition: or
- conditions:
- - condition: and
- conditions:
- - condition: template
- value_template: "{{ score >= 90 }}"
- - condition: template
- value_template: "{{ name == 'Dmitry'}}"
- alias: Если Dmitry > 90
- - alias: Если Nadezda > 85
- condition: and
- conditions:
- - condition: template
- value_template: "{{ score >= 85 }}"
- - condition: template
- value_template: "{{ name == 'Nadezda'}}"
- - condition: or
- conditions:
- - condition: state
- entity_id: alarm_control_panel.alarm_home
- state: armed_away
- - condition: state
- entity_id: alarm_control_panel.alarm_home
- state: pending
- - condition: state
- entity_id: alarm_control_panel.alarm_home
- state: triggered
- then:
- - target:
- entity_id: alarm_control_panel.alarm_home
- action: alarm_control_panel.alarm_disarm
- data: {}
- - action: telegram_bot.send_message
- data:
- message: "🚨Снято с охраны по лицу: [ {{ name }} ]"
- - alias: Если score > 90% (выставить запрет на отправку дублей)
- if:
- - condition: template
- value_template: "{{ score >= 90 }}"
- then:
- - if:
- - condition: template
- value_template: >-
- {{ trigger.payload_json['id'] !=
- states('input_text.frigate_face_id_event_detected') }}
- then:
- - action: input_text.set_value
- metadata: {}
- data:
- value: "{{ id }}"
- target:
- entity_id: input_text.frigate_face_id_event_detected
- mode: queued
- max: 10
Advertisement
Add Comment
Please, Sign In to add comment