After the relative success of my Unifi Network API driver (previously just the Unifi API driver) I decided to branch into what else my UDMP is capable of. One of those functions is the Protect area. I do not have much in the way of Protect hardware but I am able to enable it and start digging around into the features so I felt it would be useful to provide a driver for those interested.
I will obviously be expanding on it and supporting it to the best of my abilities (like all my drivers).
- Create child device(s) and populate with general status such as label (device name), uptime, and hardware type
- Additional features for the Floodlight devices (like turning it on/off)
- Additional features for Camera and Doorbell devices (like capturing a snapshot)
- Additional features for NVRs including the CPU temperature, as well as memory and storage percentages
- WebSocket support for immediate device event notifications
- Available within the Hubitat Package Manager (HPM).
- A really big one at this time... I have limited samples of actual Protect data responses to add device hardware support and capabilities. If anyone is willing to send me a Trace log when they perform a Refresh or GetProtectInfo (they are the same at this time) I would appreciate it and can start to build more in.
You MUST have the parent driver of course... children are needed for particular devices you have on Protect. So if you have a camera, also install the Camera driver. Bridges are very typical as Unifi Protect defaults to including your Access Points as bridges, so in most cases you will need that child driver.
- REQUIRED UnifiProtectAPI.groovy is the parent driver
- UnifiProtectChild.groovy is the default/generic child driver
- UnifiProtectChild-Bridge.groovy is a specific driver for handling bridge (APs) data
- UnifiProtectChild-Camera.groovy is a specific driver for handling cameras in general
- UnifiProtectChild-Doorbell.groovy is a specific driver for handling doorbells
- UnifiProtectChild-Light.groovy is a specific driver for handling Floodlights
- UnifiProtectChild-Sensor.groovy is a specific driver for handling Sensors
- Add UnifiProtectAPI.groovy driver to your Drivers Code section on your Hubitat (you can Import using the URLs above) then Save the driver. Repeat with the UnifiProtectChild.groovy driver and any specific additional child drivers (as they are added) that you might need for your system.
- Add a Virtual device and set the Type to be UnifiProtectAPI (user-added drivers are going to be at the bottom of the list), then Save Device.
- Enter your Unifi Controller's IP/Hostname, Username, and Password into their respective fields in Preferences, select your Unifi controller type, then Save Preferences.
REQUIRED: If you use the "Other Unifi Controllers" controller type, after you Save Preferences a new preference field will be displayed "Controller Port #". You should set this to the port number your controller uses for the Protect API. Default is the "standard" 7443 but just in case there are changes in newer versions of the controller software (like there has been for the Network API).
- OPTIONAL - Enable WebSockets (enabled by default) if you want to receive immediate notification of various events like motion, recording, light, etc...
The driver should automatically attempt to login and refresh the basic information from the Protect system and will attempt to refresh it per the Stats Refresh Rate preference from then on. It will also automatically create child devices from that point forward.