Custom Component: Unifi Protect

@briis Appreciate the input but that didnt help me any unfortunately. If i remove the integration, then remove the entities and then reinstall the integration will it pull everything back in and i can try setting things up cleanly?

Yes, you can delete and readd the Integration and you will get everything back.
But I am not sure it will help as you said that the binary sensor triggers fine. So it seems it is your Notify action that has an issue.
But it doesnā€™t heart to try.

Hi @briis and thank you for your component. I got my hands on 2 Unifi G4 Dome today and wanted to report that everything seems to be working fine so far!

Great work.

Thanks for the update. Are the G4 Dome cameras good? Thinking about replacing a few G3 Flex.

I donā€™t have anything to compare with but the metal body construction is solid and the picture quality is good enough for my needs. It sold out very quickly on the EU store last week :slight_smile:

1 Like

Iā€™m fairly new to HA, but for the life of me I donā€™t see ā€œUnifi Protectā€ in the available integrations.

Iā€™ve force refreshed my browser, tried different PCā€™s, clicked on the " More are available on the [Home Assistant website]" , its just not there :slight_smile:

Iā€™ve install the Ubiquiti UniFi integration no problem.

Iā€™m in Canada, but I doubt geography mattersā€¦

Can any double check and make sure itā€™s there?

Do you have HACs installed per the installation guide?

This component is not yet part of the standard components so needs to be added on either through HACs (which is the easiest method of managing additional components) or downloaded and configured as a custom component?

EDIT HACs installation instructions are here

1 Like

Thanks TazUkā€¦I wasnā€™t sure if HACs was part of the basic HA install or if it needed to be installed.

Iā€™ll install it and hopefully Iā€™m goodā€¦

1 Like

Once youā€™ve installed HACs and added the Unifi Protect integration within the HACs section, you should then be able to add the Protect integration in the usual way (you may have to restart HA after adding Protect to HACS - I canā€™t honestly remember as Iā€™ve been running it for quite some time).

Thx again ā€¦got HACS and Protect installed! now Im stumped again :slight_smile:

As per instructions ā€¦
" To add Unifi Protect to your Home Assistant installation, go to the Integrations page inside the configuration panel and add a CloudKey+ or UDMP by providing the Host IP, Port Number, Username and Password"

Integrations page is where you setup Unifi previously, now you are adding Protect.

Got it now! Had to ctrl-refresh to see it ā€¦thank you very much!

@briis you mentioned also some other stuff by installing MQTT on the Cloud Key
What ā€˜other stuffā€™ since polling is not something i prefer to have in my network.
Currently on CK gen2, probably moving to UDM pro soon.

I have no plans of implementing anything on the CloudKey or the UDMP, it was just a reference to what another person had looked at.
Currently this integration does ONLY polling - I hope that I one day figure out how to implement the Push model that is working in the Homekit integration - but my Python skills are still lagging a lot.

Sorry if I was not clear on that.

Iā€™m also seeing similarā€¦ All my unifi protect entities become unavailable for 2 seconds, before all returning to the original stateā€¦

Error requesting unifiprotect data:

I get the above in the log file. All my connectivity is wired, and unifi protect has access to all the cameras at these times.

Are we able to configure some timeout value here, or maybe a retry attempts?

1 Like

I unfortunately do see the same issue with unavailability ranging from 2 to 8 seconds before being cleared. A screenshot below:

An odd thing is that particular camera is currently offline (not wired) but Protect is running :thinking:

Oh, that is interestingā€¦ I do have 1x camera unplugged at the momentā€¦ Is this a common pattern to those that are seeing this?

I poll the status every 2 seconds to ensure a pretty accurate Motion detection, but if there is a little lag on your network, or HA is busy doing other things, this might cause the roundtrip on the cameras, to not complete, before it is asked again, thus reporting this state. (It is my qualified guess)

If you go to the Integrations Page and click the Options menu on the Unifi Protect Widget, you can adjust the polling time. Try and set it to 3 or 4 seconds and see if this makes a difference in the Unavailable frequency.

I run HA on a dedicated Intel NUC with lots of power, and I donā€™t see any of this myself. So we have to start somewhere to figure out what is causing this.

Thanks, Will increase a little, to see if it helps.
For anyone else seeing the same, my hardware is Raspberry Pi 3 Model B Plus Rev 1.3

I have the G4 Doorbell, and Iā€™ve set up two automations. The first when the motion event turns on, that kicks off a camera.snapshot. The second occurs when the movement event is finished, and it sends the previous snapshot in a notification. This works great (although slightly delayed when compared to the unifi protect notifications). It is so much nicer getting the image in the notification.

I tried adding a click action to the notification (android HA mobile app), to open the image at /local/snapshot.jpg but some strange caching issue occurs. I have to clear my browser cache in order to see the most recent image.

In trying to figure out the best way to add a click action it got me thinkingā€¦ is it possible to make the click action open the protect app? That way I can view the recorded event?