Ubiquiti Unifi Protect cameras

I'm sure you are aware of why I want to do this.

The BS geo location in Protect is useless!

1 Like

I was able to get it working thanks to testing help from @Bago and @markbellkosel84. Thanks guys!

Smart Detect support is in version 1.1 on HPM. Smart Detect has to be supported by the camera and also configured in the UniFi Protect controller.

1 Like

From what I understand smart detection is one of the differences between G3 and G4 cameras

1 Like

I just added LCD message support for the doorbell device (via Hubitat's native Notification driver capability type). This is updated on GitHub, and I bumped the version in my HPM repo for anyone who prefers to update that way.

2 Likes

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)?

1 Like

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.

1 Like

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.

@bobbyD

1 Like

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.

1 Like

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. =)

1 Like

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.

1 Like

Up above it states how to set Python 3 as default.

1 Like

Yeah, didn’t want to set it as default. “—interpreter” works. :slight_smile:

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.

5 Likes

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..

5 Likes

would you mind if I messaged you regarding this?

1 Like

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"]

`

2 Likes

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.

2 Likes

My primary problem was with doorbell function and I have actually had several uses today and yesterday. Every single one went through flawlessly!

1 Like

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.

1 Like