this post was submitted on 24 Mar 2024
23 points (96.0% liked)

homeassistant

12084 readers
2 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS
 

how can I send the contents of an entity via xmpp or a matrix notification? For example, the entity is image.ipcam_sued_person (frigate) and contains a snapshot. jpg.

how can I send it as an image with xmpp.

message: { ?????????} or with path: ???

top 8 comments
sorted by: hot top controversial new old
[–] [email protected] 9 points 8 months ago (1 children)

What has the person been sued for?

[–] [email protected] 3 points 8 months ago* (last edited 8 months ago)

The Name of the Entinität in englisch is: image.ipcamsouth_Person. frigate Person detection.

[–] [email protected] 4 points 8 months ago* (last edited 8 months ago)

I managed it:

alias: Frigate - Notification
description: ""
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: template
    value_template: "{{ trigger.payload_json[\"type\"] == \"end\" }}"
action:
  - service: notify.jabber
    data:
      title: "Kamera {{trigger.payload_json['after']['camera']}} "
      message: >-
        Objekt {{trigger.payload_json['after']['label']}} erkannt von Kamera
        {{trigger.payload_json['after']['camera']}}.
      data:
        path: >-
          /mnt/sandisk1TB/frigate/clips/{{trigger.payload_json['after']['camera']}}-{{trigger.payload_json['after']['id']}}.jpg
[–] [email protected] 3 points 8 months ago* (last edited 8 months ago) (1 children)

If you’re using xmpp, check the docs. It’s possible to send an image.

Next, you need to find where the static image is stored. How are you accessing the latest image from the IP Camera?

I think that the example in the documentation closely aligns with what you want to achieve here.

[–] [email protected] 2 points 8 months ago (1 children)

I know how to send images with xmpp. The problem is that the file name changes with every new snapshot. The entity image.ipcamsued_Person contains this current snapshot.

The question now is: how can I send the contents of this entity via xmpp. Do I have to read it out first and save it as a jpg?

[–] [email protected] 1 points 7 months ago (1 children)

Ok! So if you look at the attributes for image.ipcamsued_Person, what do you find listed? Hopefully a file path will be visible

[–] [email protected] 1 points 7 months ago (1 children)

I managed it:

alias: Frigate - Notification
description: ""
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: template
    value_template: "{{ trigger.payload_json[\"type\"] == \"end\" }}"
action:
  - service: notify.jabber
    data:
      title: "Kamera {{trigger.payload_json['after']['camera']}} "
      message: >-
        Objekt {{trigger.payload_json['after']['label']}} erkannt von Kamera
        {{trigger.payload_json['after']['camera']}}.
      data:
        path: >-
          /mnt/sandisk1TB/frigate/clips/{{trigger.payload_json['after']['camera']}}-{{trigger.payload_json['after']['id']}}.jpg
[–] [email protected] 2 points 7 months ago

Nice one! JSON and templates together are unwieldy AF, you’re braver than me