Custom Component: Unifi Protect

i have 0.110 and HA doesn’t boot anymore :frowning:

For a quick fix, you can just remove the unifiprotect folder, and restart homeassistant. Or do what briis said, but I didn’t do that yet.

Hold on a bit. It is my mistake - I accidentally put in jwt as a requirement for the pyunifiprotect module instead pyjwt. So therefore it loads that module, which it shouldnt. I’ll correct this and upload some new files. Will post here when done - It is night in Denmark, so might not before tomorrow,

I did it now anyway. Jwt error should be fixed. Wait 10 min, to make sure that HA can find the new module.

NB: For those who already try to install, you might still see the error, as jwt is now installed. But I hope not. Anyway, going forward it will not be loaded, so it will be fixed on the next upgrade of HA, or you can uninstall as described before.
/B

Works now! Got it connected and working. The only issue I’ve seen so far is this:

Entity id already exists - ignoring: binary_sensor.dream_machine_pro_doorbell_front_door. Platform unifiprotect does not generate unique IDs

So I think the motion sensor is trying to get the same name, since I am also missing the binary sensor for “motion” at the front door.

That is why testing is good. As I don’t have that doorbell, I did not test for the same device creating two binary sensors. The naming scheme for the unique_id is now changed, so that it should take care of that.

  1. Copy binary_sensor.py and overwite the existing file.
  2. Remove the Integration from HA and restart (We need to do this, as ID’s will change)
  3. Add the Integration again, and let me know if it works.
1 Like

Hi Alex,
Welcome to the World of Home Assistant and welcome to the forum. :+1:

Let me see if I can guide you through this. Basically in Home Assistant you have all the build-in Integrations, and those are the ones you find when you go to the Integration Page under settings. (Plus a few custom ones, but they only show up if you add them manually).

Beside the build-in stuff you can also add Custom Integrations like unifiprotect and in order to do that you can pick one of two ways.

  1. Copy the files yourself (Like described under Manual Installation on the Github page)
  2. Use a system called HACS, which makes it possible for guys like me to easily distribute Custom Integrations. HACS is not installed in HA pr default, so you will have to add that yourself, but it is very well documented and you can find the guide here. Once you have gone through the HACS installation, it will make it a lot easier for you in the future to install new stuff that is not build directly in to HA. So I would recommend you do that.

Once you have installed the Unfii Protect files, either manually or through HACS, you can then follow the instructions in the README file on the unifiprotect Github page, on how to configure it and get it up and running in your installation.

Hope this clarifies things for you.
/B

The latest release seems to work as expected so far! Nice work man! Thank you :slight_smile:

I’ll report back if I see any shenanigans over the next few days.

1 Like

Getting things set back up on a clean NUC install and this is giving me fits. Clean install of plugin, copied over my config data (just IP, user/pass). Getting this in the log.

2020-05-17 12:18:09 ERROR (MainThread) [custom_components.unifiprotect] Unexpected error fetching unifiprotect data: 'lastRing'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 136, in async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 124, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/unifiprotect/unifi_protect_server.py", line 72, in update
    await self._get_camera_list()
  File "/config/custom_components/unifiprotect/unifi_protect_server.py", line 190, in _get_camera_list
    if camera["lastRing"] is None
KeyError: 'lastRing'

Could you check what version of Unifi Protect you are running? The Doorbell was introduced in v1.13.3-beta.4 of Unifi protect (on the CloudKey) and if you are at a lower version than that of Unifi Protect you will need to upgrade that software.
/B

I was only on 1.12.5 (I don’t like to keep it current, unifi, you know.) I just upgraded to the latest full release (1.13.2 I think) and now it’s working.

It had been running fine on HA with 1.12.5 since I first installed the plugin on HA. But this morning I just started migrating my HA install to a NUC, starting with a clean HA install, and it wouldn’t work any more.

Glad that this fixed it. The latest version of my Integration introduced support for the Doorbell, and therefore you now need to upgrade Unifi Protect. Thanks for reporting this.

Hello I’m trying to get it to work white HomeKit is shows up in HomeKit app on my iPhone but it doesn’t look so good, can someone be so kind and test and if you get the same?, Watt codecs do it use?

1 Like

Change the video codec to copy

I wonder if this Custom Component is compatible with Unifi Video 3.10.12 running on Ubuntu Server 18.0.4?

I put the 8 prerequisite files in config/custom_components/unifiprotect
I have the following in my configuration.yaml

unifiprotect:
  host: NNN.NNN.NNN.NNN
  username: 'homeassistant'
  password: 'secretsquirrel'

camera:
  - platform: unifiprotect
binary_sensor:
  - platform: unifiprotect
sensor:
  - platform: unifiprotect

and in my logs, on reboot, get the following single entry

2020-05-21 15:68:14 INFOR (MainThread) [homeassistant.components.camera] Setting up camera.unifiprotect

Yet nothing in my devices / entities matching protect or camera.

Any help would be appreciated.

Thank you

Unifi Video is a completely different product than Unifi Protect. Unifi Protect is the replacement and only runs on the Cloud Key Gen 2 + or the UDM-Pro (I believe). There is no self-install for Unifi Protect, it has to run on UniFi hardware. As far as I know this component does not work with the older Unifi Video NVR.

1 Like

Thank you for the education. Your answer “(i believe)” is verified here : https://help.ui.com/hc/en-us/articles/360011480554-UniFi-Protect-FAQ#5

Back to the comptroller to get additional funding.

If you git tag the new version something like beta, it should be installable though HACS without having to do it manually.

Before you run to switch to Protect, take a good look to make sure you won’t be missing any functionality. I have no experience with Unifi Video but when I bought into Protect about a year ago there were a lot of posts saying that Protect was lacking many features of Video. Even though Protect is the “latest and greatest,” and what Unifi is focusing on going forward, I’m not sure they’ve gotten to parity with the Unifi Video features yet.

1 Like

I have now made a pre-release version available (0.4.0). Currently it does not show up in my HACS installation, but it is there on Github.