Unifi Protect camera motion as a trigger

I would like to use my Unifi doorbell motion detection to turn on the porch light at night. I have a UDM Pro with Protect, and I get notifications of motion and stuff but I would like to take it to the next level and somehow link it to HE. Any suggestions?

I made an integration for UniFi Protect with Hubitat. It can do what you described: Ubiquiti Unifi Protect cameras - #37 by tomw

2 Likes

Thanks for the info. I don’t have nor do I know to use a RPI. I am familiar with the unit but it seems like a lot of work to just turn on a light.

It's not too bad once you get into it, but I do agree that it's more complicated than I wish it was

Otherwise, your options would be to research other integrations that might exist that can observe events from UniFi Protect and then can signal events to Hubitat via a virtual switch or similar.

Just FYI, you could run the companion script on a PC also. You just need something that can run Python3, which can run almost anywhere.

I do have an iMac that runs 24 hours a day.

Here's a quick tutorial to run a Python script on MacOS: How to Run a Python Script on Mac - Make Tech Easier

You could try that with my script (server.py), then use my Hubitat drivers to test for connectivity to server.py and to your UDMP.

If all of that works, you'd only have to find a good method to run sever.py automatically on the Mac.

Thanks for the info. I looked into this and I think it is beyond my skill set. Sorry for wasting your time.

It's not a waste. Happy to help if you still want to give it a go. Where did you get stuck?

1 Like

I’m not stuck, as I haven’t started. I can tell it’s beyond my skill set just by looking at what has been posted.

Hello @davidcwright59 - a recent improvement made this easier to set up. It can now be run locally from Hubitat without the external PC, which should ease the setup. If you want to give it a try, please see the requirements on Hubitat version here: Ubiquiti Unifi Protect cameras - #102 by tomw

1 Like

So, I decided to give this a try. I downloaded the 3 drivers, made a controller device and set it up with IP address and such. I made a child device for 1 G3Flex camera. I was hoping to display an image to my main dashboard, but I am not sure what to do now. I chose Front Porch Cam for the device and image for the template, but it wants a url for that and I don't know where to get it. I still think I am in over my head.

It should make the child device for your camera automatically when you save the controller virtual device. Is that what you meant?

Once your camera is working on the device page, you can add a motion tile on the dashboard. You can also add an attribute tile and set it to show the attribute displayImage from the camera child device.

Then you have to find a way to execute the take() command on the child camera. You could do this manually from the device page to ensure it is working.

Then you could create a rule machine rule to execute the take() command on a schedule. Or you could create a rule that is triggered by motion on the camera whose action is to do a take(). Any time a take() happens, you displayImage attribute time would update with the new image.

1 Like

I now have image tiles on my dashboard. Hooray. Ever since I saw others with camera images I wanted that feature, but it was always a roundabout way to get there. Thank you so much for your work to get this done. I am glad there are smarter people than me on this forum.

2 Likes

I'm a Hubitat newbie/1st time poster and hoping it's OK to add to an old thread. I am making good progress on integrating my collection of home automation stuff into Hubitat, but I am stuck on how to get an image into a dashboard tile and trigger the periodic image capture. I was successful in loading the drivers and my doorbell camera shows up as a child of the controller. I see an image in the attributes section of the device view and it updates when I click the Take button, so I must be pretty close. I have created an Attribute type tile and selected the displayImage attribute, but the tile shows Please Select an Attribute. I've played around with different tile types, but not making much headway. I've also stalled out on trying to add a rule to trigger image capture once in a while. This is my first foray beyond Basic rules, so I am into Rule Machine but I haven't been able to figure out how to trigger the take{} command anywhere. Hoping someone can shed a little light on these issues.

Thanks
David

First thing to check would be the image size. Tile attributes are limited to 1024. The take() command is probably under the custom actions section for RM.

1 Like

@thebearmay is right -- this limitation makes it basically impossible to put an image from take() directly onto a dashboard because it is much bigger than 1024 characters.

Instead, I made a small companion app here that I use to re-serve the images for dashboard use - Ubiquiti Unifi Protect cameras - #127 by tomw

I never made it part of my main UniFi Protect package because there wasn't much response when I posted it, but you are welcome to try it out and I'd appreciate any feedback.

Hi and thanks for the reply. I dug a little hard into the custom actions and found the take{} command. The missing link was in selecting a Motion device type and then the camera device. Then the take{} command showed up in the list. The attribute size thing causes a bit of a problem. I changed the image size to fit the 1024 limitation and it is now working... sort of. The 1024 character limitation needs an image size of around 42 x 23. Not enough pixels to be useful. I think the attribute tile might not be the right way to do this.
David

Look at @tomw 's comment above as it may be a solution for you. May also be a way to use an image tile, but you'd have to keep the name constant.

1 Like

Thanks @thebearmay and @tomw I'll try out the helper app and see where that goes. UPDATE - I installed the imageServer app and it seems to work just fine, so thank you very much. I'll move my comments and questions to the more recent thread as I try to do more things.

Thanks again
David

1 Like

Well I just want to let you know that I use your Unifi Protect camera drivers and they work very well.
Thank You.

1 Like