Ubiquiti Unifi Protect cameras

OK, a couple of theories:

The image refreshes based on what is stored in the device attributes, but it doesn't actually take a new photo. You need to have something to execute the take command, like a rule that executes that when motion is detected or just does it on some time interval. That could explain the lack of updates.

On it not showing at all, you should note that the URL will change if you reinstall or use a different version of the app, since the app ID is embedded in the URL. So, you might need to check and make sure that the URL in the app configuration page for imageServer is the same one you are using in your dashboard tile. Just a hunch that those may be mismatched.

Ya I removed everything devices and child devices. App (image server) removed dashboard and started fresh. Still no poc shows when all reinstalled. Odd it worked before. I will look into it.

Did find a easy way to see it local only though and that might be all I need and then your drivers for motion. :slight_smile:

Did you do take at least once after you re-created the devices? If you open a camera device page, is the image displayed there?

You can link to camera jpeg and refresh every second. No muss, no fuss.

@tomw Can you share an example of a rule that uses the take command? For example, motion at my front door, camera takes a picture and sends it via text.
I went looking through Rule Machine and couldn't find anything easily.

Thanks.

Here it is in Rule Machine 4.1.

The actions page:

And the full rule:

Thank you @tomw, I got that rule to work. Please be patient with me. How do I get the image that was taken to show up on a dashboard link or sent in a text, lets say?

This is a little bit more complicated.

There is a limitation on Hubitat dashboards that makes it not possible to display the image directly. Other dashboards may not have this issue, and the two attributes (image is raw base64 encoded, and displayImage is decoded and embedded within HTML <img> tags) may be able to be used directly.

If you want to use it on a Hubitat dashboard, you can try out this app that I created. Note that this will only work inside your local network.

As for text messaging or emailing, I'm assuming you could use the attributes I mentioned before and send them with the notification to those devices. It would depend on what the specific notification system supports.

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.