just a curiosity, does HE just not have enough horsepower to do all of the decoding internally, or is it missing the necessary function(s) (the python server looks like it's just decoding and decompressing the call)?
Yep, it's a bummer that the external server is required. I'm not sure if Hubitat could handle the load (though I presume it could) -- there's no way to test because the necessary libs aren't available.
Just to be clear in case lines got crossed in this thread: the UniFi Protect driver requires the external server, but the UniFi networking driver (aka UniFi SDN previously) is all local to Hubitat.
Right. So doing Presence using like a Unifi client (cell phone, watch, etc) doesn't require server.
Wonder if any of the HE peeps could chime in on adding the necessary libs. Getting this all internal would be a serious win for us "local FTW" peeps.
It would really help with usability, too.
Maybe it is true that someone who made the investment into UniFi stuff is probably savvy enough technically and doesn't mind the few extra $$ to have something to co-process with. But it would be nicer to just install, configure(), and go.
I tried to structure my driver interaction with the external server so it would be easy to swap out a Hubitat-based version if it became available. I'd be happy to beta test and switch my code over if it would help.
One quick thought -- this is still "local" (meaning no internet/cloud interaction), but it's not running natively on Hubitat. I think that's clear, but just wanted to state it.
Totally. Sorry, wasn't saying it wasn't local. Was emphasizing the "win" rather than the local. =)
Seem to have it up and going. Sweet. Now if I could just get Juicebox to have native support for local energy reporting, I could hear down my HA install. =)
fwiw, to get things working with pm2, I had to do:
pm2 start /root/server.py --interpreter python3
instead of the first line being just "pm2 server.py".
It would error if i just did that. and without the "--interpreter python3" I would an error (because my Pi defaults to python2). Obviously note that I have server.py in /root. YMMV there.
Hmm... now it doesn't seem to be working. Need to poke more...
okay, no, it was opening port. Had to seemingly click "initialize" in the parent device and that seemed to get it going. Watching the pm2 logs was helpful.
Up above it states how to set Python 3 as default.
Yeah, didn’t want to set it as default. “—interpreter” works.
After all the help from @tomw and @bago I thought I would share a little aesthetics I whipped up for the flirc case holding the pi.
I have UniFi G4 Cameras to get the feed on to my dashboards I have enabled rtsp and then run a docker on my nas that has the command line version of Vlc setup to take an rtsp stream and output an mjpeg stream - its working fine and doesn’t use much resource on the nas .. I’m sure a pi would run this too..
would you mind if I messaged you regarding this?
Here's a working docker compose for any interested. To setup I did the following:
- Clone the hubitat_unifiProtect repo
- Create a .env file with the following values
HUBITAT_UNIFI_PROTECT_DIR=/path/to/clone/repo
HUBITAT_UNIFI_PROTECT_PORT=3000
- Saved and ran using the following docker-compose.yml file
`
version: "3.9"
services:
hubitat-unifi-protect:
volumes:
- '${HUBITAT_UNIFI_PROTECT_DIR}:/usr/src/app'
image:
python:3
ports:
- '${HUBITAT_UNIFI_PROTECT_PORT}:3000'
working_dir: /usr/src/app
entrypoint: ["python", "./server.py", "3000"]
`
Quick note- with some feedback and testing help from @markbellkosel84, I made some improvements to enhance uptime of the system. I recommend that everyone updates to version 1.2.2 via HPM or manual installation.
Only the UniFi Protect Controller driver is affected, and once you update the code please run Initialize once to kick the new changes into action.
Also thanks to @ogiewon for an excellent model on managing connection status to help ensure uptime.
My primary problem was with doorbell function and I have actually had several uses today and yesterday. Every single one went through flawlessly!
Thanks for this! I'm now running the server.py in Docker on my home server.
Thanks for this. I've successfully managed to set it up in Docker on my home server.
Hi all. I love your work. I have a quick question. I was able to get my unifi camera to work great, thanks to the amazing instructions. I can capture the image under the device page. My question is how to do I get this image to display on a dashboard, and even better how can I get this integrated with sharptools? Anyone have any ideas? Thanks!!!
You'll need to set the image size to be dashboard friendly. Then in the dashboard select the device and attribute template. Then you'll just select the image attribute.
Any idea - For motion events using the G4 Protect Doorbell, is it using the camera, PIR sensor, or both?
I'm thinking of setting up an automation to turn on my porch lights for a motion event, but would only like to do that using the PIR sensor as the camera detects motion if a car's headlights hit my lawn.
Using Smart Detect on the G4's eliminates this problem (for me at least).