01-11-2019 04:50 PM
I would prefer to not play around on the cloud key OS to get the events from Unifi protect... But maybe it is possible to reuse some of the Web-API work from other unifi adhered open source projects. I think ubnt did not reinvent the wheel for protect.
I use the iobroker.unifi adapter (https://github.com/jens-maus/ioBroker.unifi) to get information on the WiFi clients, especially known smartphone clients to decide if somebody of the family is around the house.
Best would be to integrate also the Unifi Protect API into this adapter. Since I'm still waiting to receive my new cloud key gen2, I can not start to play around with it. But maybe somebody else could at least take a look at the authentication...
4 weeks ago
Just tried with node-unifi to authenticate againt unifi protect and it seems to work. Next will be to integrate some basic API functions.
If somebody likes to try: https://github.com/jens-maus/node-unifi
3 weeks ago
+1 on API (CK fire an API call) / MQTT
I like to receive proper events in HomeAssistant. Allthough I Iike the efforts above, I preffer to keep my CK2+ clean and don't wan't to add modifications. Polling API is nice, but I prefer to have realtime events :-)
a week ago - last edited Monday
@terafin Hi, I've finally gotten my CKG2+ but the daemon doesn't seem to start. Would like to open an issue on your github but it's not available.
The script however does run when executing it manually
root@ck-plus:/usr/lib/unifi# systemctl is-active unifi-protect-mqtt activating root@ck-plus:/usr/lib/unifi# systemctl status unifi-protect-mqtt ● unifi-protect-mqtt.service - Unifi Protect Motion Detection to MQTT Loaded: loaded (/etc/systemd/system/unifi-protect-mqtt.service; enabled; vendor preset: enabled) Active: activating (auto-restart) since Sat 2019-02-09 13:06:41 CET; 194ms ago Process: 2506 ExecStart=/usr/local/bin/unifi-protect-mqtt.sh (code=exited, status=0/SUCCESS) Main PID: 2506 (code=exited, status=0/SUCCESS) CPU: 8ms Feb 09 13:06:41 ck-plus systemd: unifi-protect-mqtt.service: Consumed 8ms CPU time
I cannot see it running with an px -aux either.
And solved, had to change the username to unifi-protect, created a pull request for that one.
root@ck-plus:/usr/local/bin# systemctl status unifi-protect-mqtt ● unifi-protect-mqtt.service - Unifi Protect Motion Detection to MQTT Loaded: loaded (/etc/systemd/system/unifi-protect-mqtt.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2019-02-09 13:49:35 CET; 7s ago Main PID: 6794 (unifi-protect-m) Memory: 408.0K CPU: 10ms CGroup: /system.slice/unifi-protect-mqtt.service ├─6794 /bin/bash /usr/local/bin/unifi-protect-mqtt.sh └─6795 inotifywait -e modify /srv/unifi-protect/logs/events.cameras.log
One other question though, does this survive a firmware upgrade?
It does not... Requires reinstall after firmware upgrade.