[PROJECT] Driver for Unifi Protect Controllers

The doorbell was not showing 'Button X pressed' messages. Today's update has them back. But no 'pushed' events.

And the websocket messages are gone now too

WebSocket are gone because they are being handled. There is a pushed event at the very middle 8:22:04. It even got the "released" event from the doorbell as well (that is one of very few button devices I have ever been able to code that in for).

Are the pushed events not showing in the Event log? Because that one looks like it actually did get caught.

Correct, they show in the logs but not in the events. This was the situation when you first re-worked the push logic. The doorbell is a Pro POE model.

Another set of logs, with events this time:

A couple other questions, not related to this issue. In the Events the 'smartDetectType' event is being logged as 'none' when motion stops. That doesn't seem to be useful and takes up space in the list. Is there a way to suppress that event? And, on my G5 bullet there are no smartDetectType events. Is it possible to add that functionality to the non-doorbell cameras?

Updated Version(s):

  • UnifiProtectAPI.groovy = 0.2.36
  • UnifiProtectChild.groovy = 0.1.9
  • UnifiProtectChild-Bridge.groovy = 0.1.5
  • UnifiProtectChild-Camera.groovy = 0.
  • UnifiProtectChild-Doorbell.groovy = 0.1.11
  • UnifiProtectChild-Light.groovy = 0.1.7
  • UnifiProtectChild-Sensor.groovy = 0.1.5

Change(s):

  • Corrected flaw in event processing function. While it seems this has worked in the past it looks like maybe it no longer does... so this is being fixed across my drivers.
  • While they all had to be changed I took advantage of that to correct the driver-specific attribute names and made it so old ones will go away when preferences are saved.

Doorbell presses are working. Thanks

1 Like

Are there instructions on installing this? I am new to habitat so pardon me if this is a dumb question.

TIA

Scott

In the very first post of the thread are the basic instructions for installing it. They are based on adding the individual drivers but you could also add the drivers via HPM if you prefer that (step 1). Steps 2 and 3 (and optional 4) are the same however you get the drivers put on your Hubitat.

Happy to help with any specific questions.

1 Like

OK so I got the drivers loaded and I believe that is working as it should.

I'm sorry I missed the instructions, I did see them but by the time I got thru the 200th message in the thread I was toast.

Now I need to figure out how to view the cameras if that is possible! Thanks for your work and help!

Scott

Updated Version(s):

  • UnifiProtectAPI.groovy = 0.2.37

Change(s):

  • Handling for new authorization Token name being used by newer versions of Unifi OS.

Hi, thanks for this great driver. Just switch my old CloudKey Gen1 to a new CloudKey Gen2 (UCK-G2-PLUS) and it stopped working. To fix this, all I did is switch the Unifi Controller Type to Unifi Dream Machine and it started working again.

Now my question is: I have a new cellphone and I want to change the mac address that is being polled. How should I proceed without creating a new child device?

Presence monitoring is part of the Network API driver, not the Protect one. But switching device MAC is relatively easy now. There is a command "Replace Presence Child MAC" where you put the old MAC address and the new one and it will switch it over for you.

This was a request that got added in. Before that it was possible but a bit more involved.

2 Likes

Worked like a charm.

1 Like

Just as a heads-up... Got my hands on a G5 PTZ, so I am working on adding commands for PTZ cameras to operate their movement. Hopefully I can provide it this weekend.

Updated Version(s):

  • UnifiProtectAPI.groovy = 0.2.38
  • UnifiProtectChild-PTZCamera.groovy = NEW, added to list in initial post

Change(s):

  • Initial support for features of the PTZ cameras, based around my testing with the G5 PTZ (and hoping it works with the G4 PTZ Industrial if someone has one they want to try with). In any case, the basic PTZ functions work from the child device. For each of those 3 commands you enter a positive or negative integer. The actual number represents how many milliseconds (1000 milliseconds = 1 second) the camera will perform the action. The positive or negative determines which direction it moves or whether it zooms in/out. (Example: -500 in the Move Left Right command will move it left for 500 milliseconds). Very short times are not that useful due to delays...
  • Additional functions of the PTZ at this time include the ability to Stop the movement of the camera and have it return to it's Home position.

Note(s):

  • I hope to have more functions in the future but I wanted to get this out there initial in case anyone wanted to try it out.

If I disable MFA in account.ui.com and delete the UI Account record in my Verify app, I'm able to get this working and all the child devices appear. However, I obviously would prefer to have MFA enabled... And when I set it back up, the HE integration stops working and the Status is "MFA Login Required". If I click on Refresh or Login, it seems to push an authentication notification to Verify, and I confirm it's me... The child devices seem to be reporting accurately, but Status still says "MFA Login Required" and I randomly continue to get push notifications from Verify asking if I'm trying to login. Any ideas on what to do to resolve this?

You could create a local-only account on the controller directly, that will not be accessible from account.ui.com, but your Hubitat (and thus the drivers) would be able to access the controller.

Basically go to Admins & Users on your controller and select to add a new user. There will be checkbox to "Restrict to local access only". Select that and you can create a new admin user that will only be available locally.

Updated Version(s):

  • UnifiProtectAPI.groovy = 0.2.39
  • UnifiProtectChild-PTZCamera.groovy = 0.1.1

Change(s):

  • Added ability to move camera to preset destinations (GoToPreset). Unifi is currently limited to 9 possible presets (plus Home). This allows you to select which of those 9 destinations (by number) to have the camera reposition to. It CANNOT add a preset, this is only to go to positions you have already made presets for in the Unifi Protect app. It will not move if you send a preset that does not exist.
  • Minor change to the StopCamera command. No functional difference but it was needlessly complicated for some reason.
  • Minor change to the HomeCamera command, it can rely on the GoToPreset code to eliminate duplication.
  • Additional data handling for new data points observed. Nothing special found.
2 Likes

Hello, I am moving away from Synology and starting to add Unifi Protect cameras and using some of their Access products as well. I haven't read though all 200 posts of this thread yet but I was wondering if the webhook feature that is in the latest 4.1.37 EA release of Protect will change the way that Protect and Hubitat can interact? I don't know how webhooks work but most detections from the cameras can now generate a webhook in the new Alarm Manager. Can these webhooks communicate directly with the Hubitat somehow?

I am not sure how much value there would be to WebHooks for my drivers as they can already receive notices (via webSocket).

It COULD change the way a Hubitat and Ubiquiti setup could work if a new driver was structured to monitor for the WebHook although Hubitat only watches a specific port for incoming data (39501). It is possible to build that into a URL for your Hubitat (ex: http://192.168.0.50:39501) but I do not know if that would actually work. That new driver would then have to watch for communications from the specific MAC address (it's DNI would need to be set to the same as the Unifi controller's) just like my AmbientEcowittWeather driver monitors for data from Ecowitt gateways.

Long story short... I may/should be possible but would require a new driver and basically be a new project I think, and I am not sure how much value it would add over the existing method. I think it is more geared towards people that cannot use webSocket (since that is pretty local) and their two options are to have it go to Slack or a custom URL.

Thanks for the response. I tried to get your drivers to work tonight and was unsuccessful. I run the Protect App on a UNVR pro, not the UDMP. Should your drivers work with a UNVR as well as the UDMP? I saw a previous question about it in this thread.
Thank you