Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```
- alias: 'Frigate: Notify on person in porch'
- description: ''
- triggers:
- - topic: frigate/events
- id: frigate-event
- payload: Driveway-camera
- value_template: '{{ value_json[''after''][''camera''] }}'
- variables:
- after_zones: '{{ trigger.payload_json[''after''][''entered_zones''] }}'
- before_zones: '{{ trigger.payload_json[''before''][''entered_zones''] }}'
- camera: '{{ trigger.payload_json[''after''][''camera''] }}'
- id: '{{ trigger.payload_json[''after''][''id''] }}'
- label: '{{ trigger.payload_json[''after''][''label''] }}'
- score: '{{ trigger.payload_json[''after''][''score''] }}'
- time_clip_start: '{{ trigger.payload_json[''after''][''start_time''] - 10.0 }}'
- trigger: mqtt
- conditions:
- - condition: template
- value_template: '{{ before_zones == [''driveway''] }}'
- alias: Is object newly detected and was in the driveway prior before?
- enabled: false
- - condition: template
- value_template: '{{ ["porch"] | select("in", after_zones) | list | length > 0 }}'
- alias: Has object moved into porch area?
- enabled: true
- - condition: template
- value_template: '{{ trigger.payload_json["after"]["label"] == "person" }}'
- alias: Is object classified as person?
- enabled: true
- actions:
- - choose:
- - conditions:
- - condition: trigger
- id: frigate-event
- sequence:
- - data:
- id: '{{ id }}'
- title: Tudor Way
- message: >-
- Somebody was detected in the {{ after_zones[0] | replace("-", "
- ") | lower }}
- notifTag: '{{ id }}'
- notifIcon: 'mdi:doorbell-video'
- group: 'frigate-notification-{{ camera }}'
- importance: max
- image: >-
- https://ha.redacted.com/api/frigate/notifications/{{ id
- }}/snapshot.jpg
- clickAction: ''
- alias: Send notification to phone
- action: script.1707650069804
- - repeat:
- until:
- - condition: template
- value_template: '{{ wait.trigger.payload_json["type"] == "end" }}'
- alias: Frigate recorded event ended
- sequence:
- - wait_for_trigger:
- - topic: frigate/events
- payload: '{{ trigger.payload_json["after"]["id"] }}'
- value_template: '{{ value_json["after"]["id"] }}'
- trigger: mqtt
- continue_on_timeout: false
- timeout: '00:02:00'
- - condition: template
- value_template: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
- - data:
- id: '{{ id }}'
- title: Tudor Way
- message: >-
- {% if (wait.trigger.payload_json["after"]["sub_label"] !=
- None) -%} {{
- (wait.trigger.payload_json["after"]["sub_label"][0]) |
- title }} {%- else -%} An unrecognised {{
- (wait.trigger.payload_json["after"]["label"]) |
- replace("_", " ") | lower }} {%- endif %} was seen in the
- {{ after_zones[0] | replace("_", " ") | lower }}
- notifTag: '{{ id }}'
- notifIcon: 'mdi:doorbell-video'
- group: >-
- frigate-notification-{{
- trigger.payload_json["after"]["camera"] }}
- importance: default
- image: >-
- https://ha.redacted.com/api/frigate/notifications/{{ id
- }}/snapshot.jpg
- video: >-
- https://ha.redacted.com/api/frigate/notifications/{{ id
- }}/clip.mp4
- clickAction: >-
- https://ha.redacted.com/api/frigate/notifications/{{ id
- }}/master.m3u8
- action: script.1707650069804
- default: []
- mode: parallel
- max: 10
- trace:
- stored_traces: 25
- ```
- And then my notification script:
- ```
- alias: send_dynamic
- sequence:
- - data:
- message: "{{ message }}"
- title: "{{ title }}"
- data:
- url: "{{ video }}"
- tag: "{{ notifTag }}"
- group: "{{ group }}"
- attachment:
- url: >-
- {% if (importance == "default" and video != null) -%} {{ video }}
- {%- else -%} {{ image }} {%- endif %}
- push:
- interruption-level: >-
- {% if importance == "max" -%} time-sensitive {%- else -%}
- time-sensitive {%- endif %}
- action: notify.mobile_app_jasjeets_iphone
- mode: parallel
- icon: mdi:bell-ring-outline
- max: 10
- trace:
- stored_traces: 25
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement