Closed Rockhound53 closed 1 month ago
Hi @Rockhound53
At the moment this sounds more like a request for support, but not a concrete code issue? You should try our Community Forum or join our Discord chat server. If you could narrow down your automation to the bare minimum and providing the log file, so that reproducing (or at least understanding) the issue might be possible, than we could handle it as an issue again.
Thanks! đź‘Ť
I am seeing something similar. I don't use the blueprint, but get the thumbnail in a similar manner and also getting this error.
This is on the (now official) Unifi Protect 4.1.53 and HA 2024.8.3. I suspect protect and its new "alarm manager" has changed behavior enough to mess up my previously amazing setup.
I think what is happening is that the binary sensor flashes on and off again too quick to get the event_id that is needed to find the image. This is also causing two other problems for me. 1) it is too fast to trigger some template binary_sensors that I also use to manage things. I was able to get them to work using explicit state triggers, but now it 2) doesn't work until AFTER the event (person detection in my case) is over. Not ideal.
mea culpa for jumping too quickly on the protect update. Hopefully this gets sorted quickly and my punishment is not too severe ;)
Ich sehe etwas Ähnliches. Ich verwende die Blaupause nicht, erhalte aber das Miniaturbild auf ähnliche Weise und erhalte ebenfalls diesen Fehler.
Dies ist auf dem (jetzt offiziellen) Unifi Protect 4.1.53 und HA 2024.8.3. Ich vermute, dass Protect und sein neuer „Alarmmanager“ das Verhalten so stark geändert haben, dass mein zuvor fantastisches Setup durcheinander geraten ist.
Ich denke, was passiert, ist, dass der Binärsensor zu schnell an- und ausgeht, um die Ereignis-ID zu erhalten, die zum Finden des Bildes benötigt wird. Das verursacht bei mir auch zwei weitere Probleme. 1) Er ist zu schnell, um einige Vorlagen für Binärsensoren auszulösen, die ich auch zur Verwaltung von Dingen verwende. Ich konnte sie mithilfe expliziter Statusauslöser zum Laufen bringen, aber jetzt funktioniert er 2) erst, NACHDEM das Ereignis (in meinem Fall die Personenerkennung) vorbei ist. Nicht ideal.
mea culpa, weil ich das Protect-Update zu schnell durchgeführt habe. Hoffentlich wird das schnell geklärt und meine Strafe ist nicht zu streng ;)
Hello,
Your assumptions sound logical, the ringing of the doorbell no longer seems to create a thumbnail.
Where do you turn if there is a problem with integration?
Version 4.1.53 of Unifi Protect is now officially released, a rollback to 4.0.33 is difficult because the cameras and chimes have been updated and require a version greater than 4.1.
Best regards
There is now support for Events in the integration, since Home Assistant 2024.8. So to get the Event ID I now had to use:
event_id: "{{ state_attr('event.g4_doorbell_pro_doorbell', 'event_id') }}"
I use this in an automation I put together myself and have this line in the variables: section in the trigger.
Not sure how to change the blueprint...
But I don't think it has to do with the Unifi Protect upgrade (will test shortly).
edit: Yep, have tested after updating to 4.1.53 and I still get the thumbnail with this method.
I was able to get the snapshot to work by using the event as you posted. I don't understand much about the event structure but best I can tell is that particular event is for the doorbell press. is that correct? In my search so far, I don't see anything similar for "person detected" event type/class (my use case)
Also, nothing appears to happen until AFTER the event is over. I have tested this in just about every way I can think of (automation, trigger, state change). Previously, the person_detected binary sensor would turn on at the start of the event and turn off once that event ended. Now it appears to toggle briefly once the event ends. I have seen the "event_id" appear in the attributes of the binary sensor as before, but just doesn't stick long enough to capture.
I am playing around with the new webhooks available in the new alarm manager. Maybe I can use those to get things to fire at the START instead of at the END
Any ideas?
Hmm yes the event is for the doorbell ring, so in that sense it makes sense it doesn't fire for person detected...
Not sure how that needs to be done now... I just figured out how to use the event for my use case, I also don't know much about how events work in Home Assistant...
Some good news.
I noticed that the "object_detected" continues to work as the other specific sensors used to work. It turns on at the start of the event and off once it is over. It also contains the "event_id". So retrieving the snapshot/thumbnail and video work again.
So after a bit of re-wiring, I am back in business! Only downside is that it doesn't differentiate as to what object was detected. It seems to be just any of the "people, cars, animals, etc." that are selected in smart detection in Protect.
Hello everyone,
I've now set it to "object detection". Then at least you don't get a trigger every time a cloud passes by.
Can we expect help from the developers of the Unifi Protect integration on this?
Best regards
There is now support for Events in the integration, since Home Assistant 2024.8. So to get the Event ID I now had to use:
event_id: "{{ state_attr('event.g4_doorbell_pro_doorbell', 'event_id') }}"
I use this in an automation I put together myself and have this line in the variables: section in the trigger.
Not sure how to change the blueprint...
But I don't think it has to do with the Unifi Protect upgrade (will test shortly).
edit: Yep, have tested after updating to 4.1.53 and I still get the thumbnail with this method.
Thanks for sharing. I'm also not getting any thumbnail since a week/weeks.
How would I change your code to make it work witha G4 camera, do you know? "event." doesn't list any cameras.
There is now support for Events in the integration, since Home Assistant 2024.8. So to get the Event ID I now had to use:
event_id: "{{ state_attr('event.g4_doorbell_pro_doorbell', 'event_id') }}"
I use this in an automation I put together myself and have this line in the variables: section in the trigger. Not sure how to change the blueprint... But I don't think it has to do with the Unifi Protect upgrade (will test shortly). edit: Yep, have tested after updating to 4.1.53 and I still get the thumbnail with this method.Thanks for sharing. I'm also not getting any thumbnail since a week/weeks.
How would I change your code to make it work witha G4 camera, do you know? "event." doesn't list any cameras.
The event is only for the doorbell, not for camera's that are not doorbells as far as I know...
How would I change your code to make it work witha G4 camera, do you know? "event." doesn't list any cameras.
Pretty straightforward, at least conceptually. What you need to do is change the trigger from the specific sensor (e.g. binary_sensor.g4_camera_person_detected) to the more generic, but still working (binary_sensor.g4_object_detected). This includes both for the initial trigger, and for capturing the event_id, (e.g. for my doorbell, it is "{{ state_attr('binary_sensor.g4_doorbell_pro_object_detected', 'event_id') }}" )
The problem is not really with the event_id or thumbnail itself, it is with the individual smart detection binary_sensors in the integration (see the issue on this topic). Unifi really made a mess with their latest changes. I have no doubt it will get fixed, eventually. Till then, this patch is working great.
I made this change for all my cameras and everything works great, including the thumbnails. Only issue is that the "object_detected" sensor trips on ANY smart detection you have enabled for the camera (animals, cars, etc.). So you may also want to adjust that as well, in protect.
Hi Thanks a million for explaining this. So if I understand it right, this is how it should be? Or should also the first "config_entry" be changed? This should then notify me on smart motions (persons, cars, animals)?
data: image: >- /api/unifiprotect/thumbnail/{{ config_entry_id('binary_sensor.altanen_object_detected') }}/{{ state_attr('binary_sensor.altanen_object_detected', 'event_id') }}
Seems to work but I also had to change the automation trigger to binary_sensor.altanen_object_detected, is that correct?
Yes, the "config_entry" needs to be changed to the "_object_detected" as that is where the event_id is in the attributes.
Yes, the automation trigger must be on the "_object_detected" entity as that is the only one that still works correctly.
Yes, the "config_entry" needs to be changed to the "_object_detected" as that is where the event_id is in the attributes.
Yes, the automation trigger must be on the "_object_detected" entity as that is the only one that still works correctly.
Thank you for your help, highly appreciated! Got it to work but about 20-50% of the times I still don't get an image. Here is an example, pretty strange. Do you have the same?
No, I don't have those issues, the thumbnail works every time. Are you using the blueprint?
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment đź‘Ť This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
FYI for others running into this problem, my solution was to stop using state_attr() which appears to have a timing issue with automations (e.g. the event_id is not there anymore by the time that function gets run). I now get the event_id directly from the trigger object since it has the new attributes directly in the object.
variables:
camera_name: "{{ device_attr(trigger.entity_id, 'name') }}"
nvr_id: "{{ config_entry_id(trigger.entity_id) }}"
event_id: "{{ trigger.to_state.attributes.event_id }}"
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
The problem
Since a recent update, I have had the problem that no thumbneils are created for Smart Detections (Person, Animal, Car, etc.) in my Unifi Protect integration.
The following error message appears in the logs when the automation is triggered:
Client error (404): Event thumbnail not found
A thumbnail is created with the Motion Decetion Sensor.
I hope someone can help me so that the automation works again with the smart sensor.
What version of Home Assistant Core has the issue?
2024.8.3
What was the last working version of Home Assistant Core?
2024.7
What type of installation are you running?
Home Assistant OS
Integration causing the issue
UniFi Protect
Link to integration documentation on our website
https://www.home-assistant.io/integrations/unifiprotect
Diagnostics information
Logger: homeassistant.components.unifiprotect.views Quelle: components/unifiprotect/views.py:64 Integration: UniFi Protect (Dokumentation, Probleme) Erstmals aufgetreten: 12:13:14 (52 Vorkommnisse) Zuletzt protokolliert: 15:57:26
Client error (404): Event thumbnail not found
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response