<commit_before>id: 'frigate_new_notification'
alias: 'Frigate new notification'
initial_state: 'on'
mode: parallel
trace:
  stored_traces: 20
trigger:
  - platform: mqtt
    topic: frigate/events
    payload: "new"
    value_template: "{{ value_json['type'] }}"
action:
  - variables:
      camera: "{{ trigger.payload_json['after']['camera'] }}"
      stationary: "{{ trigger.payload_json['after']['stationary'] == true }}"
      id: "{{ trigger.payload_json['after']['id'] }}"
      object: "{{ trigger.payload_json['after']['label'] }}"
      label: "{{ object | title }}"
      zones: "{{ trigger.payload_json['after']['current_zones']|join(', ')|replace('_',' ') }}"
      entered_zones: "{{ trigger.payload_json['after']['entered_zones']|join(', ')|replace('_',' ') }}"
      type: "{{ trigger.payload_json['type'] }}"
      external_url: !secret remote_base
  - service: notify.logfile
    data:
      message: "{{ id }} is a {{ type }} event {{ id }} for {{ label }} for camera {{ camera }} entered zones {{ trigger.payload_json['after']['entered_zones'] }} and current zones {{ trigger.payload_json['after']['current_zones'] }}"
  - service: notify.logfile
    data:
      message: "{{ id }} interesting zone: {{ ['road', 'front_path', 'drive']|select('in',trigger.payload_json['after']['current_zones'])|list|length > 0 }}/ {{ ['road', 'front_path', 'drive']|select('in',trigger.payload_json['after']['entered_zones'])|list|length > 0 }}"
  - condition: template
    value_template: "{{ (['road', 'front_path', 'drive']|select('in',trigger.payload_json['after']['current_zones'])|list|length > 0) or (['road', 'front_path', 'drive']|select('in',trigger.payload_json['after']['entered_zones'])|list|length > 0) }}"
  - service: notify.discord
    data:
      message: "A {{ type }} {{ label|lower }} was detected in the {{ zones }} by the {{ camera }} camera"
      target: >-
          !secret discord_camera_channel
      data:
        embed:
          title: "{{ label }} in the {{ camera }}"
          description: "A {{ type|lower }} {{ label }} was detected in the {{ zones }}"
          url: "{{ external_url}}/api/frigate/notifications/{{ id }}/{{ camera }}/clip.mp4"
          thumbnail:
            url: "{{ external_url }}/api/frigate/notifications/{{ id }}/thumbnail.jpg"<commit_msg>Automated update at 2022-10-18 12:03<commit_after>id: 'frigate_new_notification'
alias: 'Frigate new notification'
initial_state: 'on'
mode: parallel
trace:
  stored_traces: 20
trigger:
  - platform: mqtt
    topic: frigate/events
    payload: "new"
    value_template: "{{ value_json['type'] }}"
action:
  - variables:
      camera: "{{ trigger.payload_json['after']['camera'] }}"
      stationary: "{{ trigger.payload_json['after']['stationary'] == true }}"
      id: "{{ trigger.payload_json['after']['id'] }}"
      object: "{{ trigger.payload_json['after']['label'] }}"
      label: "{{ object | title }}"
      zones: "{{ trigger.payload_json['after']['current_zones']|join(', ')|replace('_',' ') }}"
      entered_zones: "{{ trigger.payload_json['after']['entered_zones']|join(', ')|replace('_',' ') }}"
      type: "{{ trigger.payload_json['type'] }}"
      external_url: !secret remote_base
  - service: notify.logfile
    data:
      message: "{{ id }} is a {{ type }} event {{ id }} for {{ label }} for camera {{ camera }} entered zones {{ trigger.payload_json['after']['entered_zones'] }} and current zones {{ trigger.payload_json['after']['current_zones'] }}"
  - service: notify.logfile
    data:
      message: "{{ id }} interesting zone: {{ ['road', 'front_path', 'drive']|select('in',trigger.payload_json['after']['current_zones'])|list|length > 0 }}/ {{ ['road', 'front_path', 'drive']|select('in',trigger.payload_json['after']['entered_zones'])|list|length > 0 }}"
  - condition: template
    value_template: "{{ (['road', 'front_path', 'drive']|select('in',trigger.payload_json['after']['current_zones'])|list|length > 0) or (['road', 'front_path', 'drive']|select('in',trigger.payload_json['after']['entered_zones'])|list|length > 0) }}"
  - service: notify.discord
    data:
      message: "A {{ type }} {{ label|lower }} was detected in the {{ zones }} by the {{ camera }} camera at {{ as_timestamp(now())|timestamp_custom('%Y-%m-%d %H:%M:%S',now()) }} local"
      target: >-
          !secret discord_camera_channel
      data:
        embed:
          title: "{{ label }} in the {{ zones }}"
          description: "A {{ type|lower }} {{ label }} was detected in the {{ zones }}"
          url: "{{ external_url}}/api/frigate/notifications/{{ id }}/{{ camera }}/clip.mp4"
          thumbnail:
            url: "{{ external_url }}/api/frigate/notifications/{{ id }}/thumbnail.jpg"
{'fraction_non_alphanumeric': 0.2104480781482268, 'fraction_numerical': 0.005521342110851561, 'mean_word_length': 4.136314067611777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6532739', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1468, 'n_words': 291}