frigate-hass-integration icon indicating copy to clipboard operation
frigate-hass-integration copied to clipboard

Access the event id from a binary_sensor.*_occupancy state change

Open frankhommers opened this issue 2 years ago • 1 comments

I would like to access the event_id so I can build an image URL.

I am triggering now on the state change of binary_sensor.*_occupancy from off to on. But after that I am not able to access the event_id (Or maybe I am overlooking things...).

Is this a new feature? Am I overlooking things? Or is it a bug?

frankhommers avatar Oct 10 '22 18:10 frankhommers

We recommend using the MQTT topic for this, the binary sensor / frigate doesn't have this info and I think it would be quite difficult especially in cases where multiple objects enter at the same time and also for different zone binary sensors.

If you just want an image you can use /api/<camera>/<label>/thumbnail.jpg to get the latest image for that camera and label

NickM-27 avatar Oct 10 '22 18:10 NickM-27

I'll try that. But I thought I was doing /api/<camera>/<label>/snapshot.jpg and that lagged just one event behind. I'll report back if this still happens

frankhommers avatar Oct 11 '22 14:10 frankhommers

Unfortenately the /api/<camera>/<label>/snapshot.jpg lags one event behind.

frankhommers avatar Oct 11 '22 14:10 frankhommers

Just tested with /api/<camera>/<label>/thumbnail.jpg that also lags one event behind.

frankhommers avatar Oct 11 '22 15:10 frankhommers

You likely need to give it some delay, it takes time after the object is first detected before a snapshot / thumbnail is saved. But it will return a snapshot / thumbnail for in progress events. The same would happen if trying to get the thumbnail via event id

In any case, if you want granular control using MQTT topics is the way to go.

NickM-27 avatar Oct 11 '22 15:10 NickM-27