Ubiquiti Unifi Protect cameras

I posted a new version in this thread, which adds a command to configure the recording mode for a camera: Recording UniFi Cameras When HSM Mode is Away - #5 by tomw

@jsfinn, please feel free to use this thread for reference and any discussion on getting things up and running.

1 Like

Just wanted to note that I have wanted this for a while, just never thought to ask!

Looks to be working well from what I can tell. My only .02 would be maybe store the current recording state into an attribute for the device. I’m doing that manually with RM and a hub variable so that I don’t unnecessarily change the setting. Although pretty minor, there’s probably no negative effect from sending duplicate commands.

@tomw , I was able to get it up and running without trouble and created Rule Machines to switch recording on or off based on HSM status.

I'll do more testing later but so far, so good.

I'm so happy! Thank you for the driver and support!

1 Like

Thanks, glad it is working for you.

I agree, it seems pretty innocuous to send a command to change it to the same/current setting. Honestly, I'd expect the overhead of checking the attribute on Hubitat to be more impactful to overall performance than it would for an unnecessary command on the UniFi Protect side.

I'll keep it in mind and consider adding an attribute when I next edit the driver. Do any other useful attributes come to mind?

Nothing immediately comes to mind data attribute wise.

If you want a feature request that maybe wouldn’t be super easy to implement cleanly.. right now I translate person and car smart detect changes into virtual motion devices using RM so that I can more easily use some of the built in apps (motion = person seen, inactive = no person).

Could be nice to have a separate child device that represents the smart detect events. I’m just not sure how you’d do that and not en up with a long list of children devices for each camera.

Tomw
I got it connected once I updated the system to 2.11 Now to figure out how to get the doorbell to work over HE so I can play a file over my chromecast speakers :slight_smile:

2 Likes

For the doorbell, you should have gotten a child device of type UniFi Protect Doorbell.

You can use events with Rule Machine from the button being pushed on that device. It gives an event when the doorbell button is pushed. You can also send text to the LCD screen by sending a notification to the device from Hubitat.

I have the child for my cameras and for the doorbell. Do I need the python script to run? When I press the doorbell button I get no status change.
Thanks

No, you don't need the Python script running if you are on a new enough version of Hubitat software.

What does the device page and events history look like for the doorbell device? You should see a pushed event on button 1 on the doorbell device for each time you press the physical doorbell button.

That is the event that you use as a trigger in Rule Machine.

Thanks Tom. I do see the 1 for the doorbell. In the history. Shouldn't it revert to a 0 after the press? I have to look at my rule to see what is "not" going on

One is the button number, so no.

You need to look at pressed.

1 Like

Yep, specifically, you should look at the Events history by clicking on the link on the Hubitat device page. You should see timestamped events that correspond to you pressing the physical doorbell button.

I got it working. My action in the rule was failing. No wto figure that out :slight_smile:

1 Like

Unable to get connected. The log is showing:

dev:9412022-03-28 11:58:51.127 errorgroovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.String#. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class [B] [class [C] [class java.lang.String] on line 213 (method refresh)

dev:9412022-03-28 11:58:51.108 debugreadBootstrap() failed: Ambiguous method overloading for method java.lang.String#. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class [B] [class [C] [class java.lang.String]

Unifi Dream Machine PRO: (Beta Tester)
UniFi OS UDM Pro 1.12.15
Protect Version: 1.21.4
Controller Version: 7.1.59

Hubitat
Revision: C-7
Platform Version: 2.3.1.129

Interesting. I wonder if the Groovy update in 2.3.1 broke something. Are you able to try it on a 2.3.0 release? I am still on that version (usually wait for the dust to settle on new versions). I will try updating when I get a moment to tinker with it.

I am unable to use 2.3.0. I had to upgrade to 2.3.1 due to Z-Wave issues.

I'll update to 2.3.1 and give it a shot.

Update: this still works for me on 2.3.1, so that doesn't seem to be the issue. I may have to look at Protect next. I'm still on 1.18 on that side.

I'm going to see if I can remove the specific functionality that seems to be breaking just to rule out a more fundamental issue.

FYI, saw your other post on another thread regarding UniFi Protect. My drivers do support button press events for the doorbell (and real-time motion detection and smart detection events). So if we can get this working with your setup, you should be able to get that functionality.

I started looking @snell's code when I realized this one stopped communicating. He has done a lot of great work also. I was using this initially, but it recently broke, and in turn, I no longer have my Google Home Mini's announcing someone is at the door.

Ah, I thought that it never worked. Did you also recently update Protect? Any clues on which step or any potential change in configuration might have been the step that caused it to break?