GithubHelp home page GithubHelp logo

hjdhjd / homebridge-unifi-protect Goto Github PK

View Code? Open in Web Editor NEW
1.4K 39.0 82.0 7.11 MB

:video_camera: Complete HomeKit integration for all UniFi Protect device types with full support for most features including HomeKit Secure Video, and more. https://homebridge.io

License: Other

TypeScript 89.02% HTML 1.80% JavaScript 9.18%
homekit-support unifi-protect-controller unifi-protect-devices unifi-protect unifi ubiquiti motion-sensor doorbell udm-pro homebridge

homebridge-unifi-protect's People

Contributors

bcomnes avatar dansimau avatar dependabot[bot] avatar dsully avatar ghenkhaus avatar glynd avatar hjdhjd avatar oznu avatar ptescher avatar rotx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebridge-unifi-protect's Issues

Correct username/password resulting in server error 500 when attempting to retrieve configuration

I have a local (limited admin) user on a UDMP + Protect configuration. Username/password is definitely correct (I purposefully made it incorrect and, as expected, this changes to an auth error).

This repeats ad-nauseum. I'm happy to grab logs, etc, whatever, but just need a pointer as to where to start.

[8/4/2020, 6:47:04 PM] [UniFi Protect] 10.0.0.1: Unable to retrieve NVR configuration information from UniFi Protect. Will retry again later.
[8/4/2020, 6:47:04 PM] [UniFi Protect] Error: 500 - Internal Server Error

Camera gone after update

Had the previous version of this plugin working fine, and I've read the instructions shared via changelog.

  1. First tried an update of the plugin, then manually checking the config.json and removing the old config block, restarted and could see the camera in Home app but no video.

  2. Completely uninstalled the plugin, removed any cameras in HomeKit, restarted.

  3. Reinstalled the plugin and entered all config manually. On restart, the camera no longer appears nor does it appear if I go through 'add accessory' process.

I've repeated 3 now several times, but cannot get the camera itself to reappear in Home app. Am I missing something? Is there another place I need to remove the 'old' camera?

Details:

Homebridge: 1.2.0b33
MacOS server (native)
Unifi Protect on UCKG2+

Support for Unifi Dream Machine Pro

I wanted to put this here for those that may be trying to use this with the UDM-Pro as it will not work in most environments. Currently, the API is returning an IPv6 address for the nvr.host property. This means this plugin will not work as-is (though may work if you have setup IPv6 in your network). I could not find an option to disable IPv6 on the controller, so I believe the only way to work around this is if we had a way to override the json response for 'nvr.host'.

Snippet response from api/bootsrap:

...
"nvr": {
        "mac": "FCECDAAAAAAA",
        "host": "fe80::aaaa:aaaa:aaaa:aaaa",
        "name": "UDM-Pro",
        "canAutoUpdate": false,
...

Doorbell aspect ratio off

I just added the G4 Doorbell and the image is stretched on both the snapshot and on the video stream. Does this happen with the other cameras too? Is there a way to specify a custom aspect ratio or something for the doorbell?

TypeError: Cannot read property 'replace' of undefined

07/06/2020, 20:45:49 TypeError: Cannot read property 'replace' of undefined
    at getUnifiAuthConfig (/home/hoobs/.hoobs/node_modules/homebridge-unifi-protect2/index.js:34:56)
    at /home/hoobs/.hoobs/node_modules/homebridge-unifi-protect2/index.js:159:14
    at Array.map (<anonymous>)
    at unifiPlatform.didFinishLaunching (/home/hoobs/.hoobs/node_modules/homebridge-unifi-protect2/index.js:158:32)
    at API.emit (events.js:210:5)
    at Server.run (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:104:18)
    at module.exports (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/cli.js:84:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/@hoobs/hoobs/bin/hoobs:95:81)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11
07/06/2020, 20:45:49 Bridge is running on port 51826.
07/06/2020, 20:45:49 Got SIGTERM, shutting down Bridge...

I installed the plugin, within HOOBS, but the moment I save the config and HOOBS restarts my homebridge setup I get the above error.

Any idea what could be going wrong?

Connection reset happening every hour according to Homebridge log

Hi there,

I was looking at my Homebridge log for the first time in quite some time and noticed some frequent activity coming from the plug-in.

[8/13/2020, 2:15:19 PM] [UniFi Protect] X.X.X.X: Connection reset.
[8/13/2020, 2:15:19 PM] [UniFi Protect] X.X.X.X: Unable to retrieve NVR configuration information from UniFi Protect. Will retry again later.
[8/13/2020, 2:15:29 PM] [UniFi Protect] UniFi Controller [UDM-PRO]: Connected to the Protect controller API (address: X.X.X.X mac: XXXXXXXXXXX).
[8/13/2020, 2:15:29 PM] [UniFi Protect] UniFi Controller [UDM-PRO]: Connected to the UniFi realtime system events API.

This supposed connection reset seems to be happening every hour, on the hour. I was wondering whether or not this event is normal?

Thanks!

Re-add previously removed cameras

I’ve removed a couple cameras directly from HomeKit because I thought I was having issues. Now when I go to “Add Accessory” in HomeKit those two cameras won’t show up.

What can I do to fix that ? ;)

homebridge-unifi-protect2 v1.3.5 with Unifi Protect NVR Appliance

Unifi Protect Controller 1.13.3
Web UI 1.20.0
Node.js Version | v12.18.0
NPM Version | v6.14.5

I can not get any of my cameras to show up in HomeBridge.
[6/11/2020, 05:20:49] [UniFi Protect] Unable to bootstrap cameras from UniFi Protect controller: Error: No cameras with enabled RTSP channels found. Only cameras with RTSP streams enabled can be used with this plugin. Please enable RTSP on at least one camera in UniFi Protect.
[6/11/2020, 05:20:49] [UniFi Protect] Unable to register cameras with HomeKit: TypeError: Cannot read property 'forEach' of undefined

I have tried for the URL https://CONTROLLERIP and https://ControlerIP:7443

I have created a local user account on the Protect System and can login fine with that. I know my RTSP streams work as I can view them in VLC just fine.

Request - MAC address ease of use

When using the enable & disable features requiring a mac address, it would be super helpful if we could have two features:

  1. Accept notation with colons, so we can copy directly from Unifi
  2. Log an warning message on startup if Mac address is malformed, i.e. fat fingered and removed a digit by accident

Nice to haves. Thanks.

Console spam even after adding cameras

Not a huge issue, but is is possible to eliminate these messages after the cameras are added to HomeKit?

[6/15/2020, 12:03:56 PM] Homebridge is running on port 51352.
[6/15/2020, 12:03:57 PM] Kitchen is running on port 38307.
[6/15/2020, 12:03:57 PM] Please add [Kitchen] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Front Door Top is running on port 34365.
[6/15/2020, 12:03:57 PM] Please add [Front Door Top] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Front Foyer is running on port 46191.
[6/15/2020, 12:03:57 PM] Please add [Front Foyer] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Crib is running on port 46785.
[6/15/2020, 12:03:57 PM] Please add [Crib] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Living Room is running on port 33095.
[6/15/2020, 12:03:57 PM] Please add [Living Room] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Dining Room is running on port 36253.
[6/15/2020, 12:03:57 PM] Please add [Dining Room] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Nursery is running on port 44641.
[6/15/2020, 12:03:57 PM] Please add [Nursery] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Front Door is running on port 34471.
[6/15/2020, 12:03:57 PM] Please add [Front Door] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Garage Right is running on port 39119.
[6/15/2020, 12:03:57 PM] Please add [Garage Right] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Garage Left is running on port 44525.
[6/15/2020, 12:03:57 PM] Please add [Garage Left] manually in Home app. Setup Code: --**
[6/15/2020, 12:03:57 PM] Loft is running on port 39999.
[6/15/2020, 12:03:57 PM] Please add [Loft] manually in Home app. Setup Code: --**

And with debug disabled, should we still see the plugin spitting routine use to the console?

[6/15/2020, 12:09:02 PM] [UniFi Protect] Snapshot from Crib at 480:270
[6/15/2020, 12:09:02 PM] [UniFi Protect] Snapshot from Front Door at 480:270
[6/15/2020, 12:09:02 PM] [UniFi Protect] Snapshot from Front Door Top at 480:270
[6/15/2020, 12:09:02 PM] [UniFi Protect] Snapshot from Dining Room at 480:270

I feel like the console should be silent except to report errors, not warnings or info.

Multiple Homes, one hub & cloudkey

Thank you for version 3. Big update, very useful.

Is there any other way to handle multiple homes without having to setup multiple home bridges? It would be great to assign cameras to "homes" or have a way to add the same hub to multiple homes and then remove the cameras. The current implementation of disabling specific cameras can support this but only by maintaining multiple home bridge hubs.

Any thoughts on supporting multiple homes? It's a huge blind spot in most IoT implementations right now. Lutron only recently got round to supporting it even.

Steaming fails with ffmpeg exit code 0

First off I just want to say thank you very much @hjdhjd for this amazing plugin!

I have:

  • UniFi Protect G4 Doorbell
  • UniFi Dream Machine Pro
  • Raspberry Pi 4B (2GB).

I'm currently running:

  • Homebridge v1.1.2
  • Node v12.18.2
  • Homebridge UniFi Protect v3.5.1
  • UniFi Protect v1.14.11

After installing the plugin the doorbell was automatically detected, and snapshots work flawlessly 🥳 !

However, when I attempt to pull the camera stream up in HomeKit (iOS 13.6.1) I'm greeted by spinning wheel and no stream loads.

I see the following output from Homebridge:

[8/28/2020, 16:02:31] [UniFi Protect] Doorbell: HomeKit video stream request received: 1280x720, 30 fps, 299 kbps.
[8/28/2020, 16:02:51] [UniFi Protect] Doorbell: ffmpeg exited with code: 0 and signal: null (Error)
[8/28/2020, 16:02:51] [UniFi Protect] Doorbell: Stopped video stream.

Obviously by all appearances this appears to be an ffmpeg issue, but I'm not sure how to get more verbose logs to identify the exact issue.

I tested building ffmpeg on my own (via this script), which didn't seem to make any difference.

I have tested setting Enable.StreamOnly.Low and found that after a few seconds the stream begins, and after about 4-5 seconds of streaming video it freezes and I get the same error in the logs.

I'm not sure where to go from here on better identifying and correcting the issue.

snapshot and stream error

No matter how hard I try I cant get this to work. Ive installed the camera-ffmpeg plugin and this one. My camera is detected in Homebridge and I can add it to the Home app. But there is no snapshot or stream...

This is my config

{
    "bridge": {
        "name": "Homebridge",
        "username": "0E:BE:B9:9A:64:89",
        "port": 53553,
        "pin": "031-45-154"
    },
    "accessories": [],
    "platforms": [
        {
            "platform": "TplinkSmarthome",
            "name": "TplinkSmarthome"
        },
        {
            "name": "Config",
            "port": 8080,
            "auth": "form",
            "theme": "teal",
            "tempUnits": "c",
            "platform": "config"
        },
        {
            "platform": "Camera-UniFi-Protect",
            "name": "UniFi Protect",
            "controllers": [
                {
                    "url": "https://192.168.1.7:7443/",
                    "username": "homebridge",
                    "password": "xxxxxx"
                }
            ]
        }
    ]
}

These are the errors

Screen Shot 2019-08-28 at 7 11 52 PM

Start stream delay, audio, latency

The 3 main issues I have with this plugin:

  • the delay when you initiate a video stream (long spinning circle load time)
  • a big 5-10 sec lag on the video stream itself
  • no apparent audio support (or at least if there is, no audio in my case)

Perhaps dev can look at the code for homebridge-ring and borrow an idea or two. It is super snappy, very responsive and is able to send audio and video to the Home app with about a 0.5 second delay. Also uses ffmpeg, but relies on a video stream from Ring servers.

I'm sure since it relies on LAN devices and not a web server, this plugin can do even better!

Cameras not streaming

In newest release 3.0.2 the camera tiles update fine every 10 seconds, but the streams won't start. Happens with G3 Flex cameras and doorbell the same

[8/4/2020, 10:31:46 PM] [UniFi Protect] UDMPRO [UDM-PRO] Front [UVC G3 Flex]: Stream quality configured: High.
[8/4/2020, 10:39:31 PM] [UniFi Protect] Front: Starting video stream: 1280x720, 30 fps, 299 kbps.
[8/4/2020, 10:40:01 PM] [UniFi Protect] Front: Stopped video stream.

In Homekit - "No Response - This Camera is not responding"
Then after going back to main Homekit page, the tiles will no longer update.
Once I force quit Homekit, and go back in, the tiles update normally.

This is on iPhone homekit. I ran another test on Apple TV HomeKit and it pulls a 1080p stream and works. vs the iPhone pulling a 720p stream and not working

Worked fine before latest update. No added config, just a straight uninstall/install. Then deleted old cameras from Homekit
UDM Pro - 1.7.2
Protect - 1.14.11

Large delay (10-20s) in opening stream

Using v3.0.2, I'm seeing huge delays in starting the stream. What's strange, however is that 95% of the time spent waiting for the stream to come up, nothing is displayed in the homebridge logs. At the very last second, you see the line that the stream has started:

[8/4/2020, 8:04:27 PM] [UniFi Protect] Kitchen: Starting video stream: 1280x720, 30 fps, 299 kbps.

Then the stream starts within a second or two of that line being written to the log.

All settings are set to their default, I have tried disabling Medium and High streams and tried the follow ffmpeg parameters in an attempt to shorten the delay as these settings used to result in a stream start of 1-2 second in the prior version (v1.2.14):

-preset ultrafast -tune zerolatency -profile:v high -level 4.2 -x264-params intra-refresh=1:bframes=0

That seems to make things take significantly longer. I tried to capture a debug log, but because of the extremely verbose polling logging, it was impossible to sift through what was related to only the single camera I was trying to troubleshoot.

Device: UniFi Cloud Key G2+
Firmware Version: v.1.1.13
Controller Version: 1.13.4

No streaming video on Centos install with working ffmpeg

I have an install on Centos, camera's show up but streaming video is not working. When I use the plugin Homebridge Camera FFmpeg I do have streaming video. Any ideas on what could be causing this? Snapshots are working, its is just the streaming video that is not working. Log says this when requesting stream through Home App on iPhone:

[8/26/2020, 3:48:46 PM] [UniFi Protect] Frontdoor: HomeKit video stream request received: 1280x720, 30 fps, 299 kbps.
[8/26/2020, 3:48:46 PM] [UniFi Protect] Invalid loglevel "level+verbose". Possible levels are numbers or:
[8/26/2020, 3:48:46 PM] [UniFi Protect] "quiet"
[8/26/2020, 3:48:46 PM] [UniFi Protect] "panic"
[8/26/2020, 3:48:46 PM] [UniFi Protect] "fatal"
[8/26/2020, 3:48:46 PM] [UniFi Protect] "error"
[8/26/2020, 3:48:46 PM] [UniFi Protect] "warning"
[8/26/2020, 3:48:46 PM] [UniFi Protect] "info"
[8/26/2020, 3:48:46 PM] [UniFi Protect] "verbose"
[8/26/2020, 3:48:46 PM] [UniFi Protect] "debug"
[8/26/2020, 3:48:46 PM] [UniFi Protect] "trace"
[8/26/2020, 3:48:46 PM] [UniFi Protect]
[8/26/2020, 3:48:46 PM] [UniFi Protect] Frontdoor: ffmpeg exited with code: 1 and signal: null (Error)
[8/26/2020, 3:48:46 PM] [UniFi Protect] Frontdoor: Stopped video stream.

Rich notifications on iOS 13

Due to changes in iOS 13 rich notifications no longer work if the motion sensor is not part of the camera (accessory of). This has been resolved through a pull request in homebridge-camera-ffmpeg initiated by NorthernMan54 (Sunoo/homebridge-camera-ffmpeg#332)
@hjdhjd Would it be possible to implement the recent updates in homebridge-camera-ffmpeg to facilitate this? I have merged the code into index.js and it seems to be working. Alternately as this solution is specific to Unifi Protect would it be possible to merge in the motion sensor capability from homebridge-unifi-protect-motion-sensors?

Favorites for Camera on/off Affects Camera itself

When I select in Homekit "show as separate tiles", putting the "camera control" switch as a favorite or removing it make the camera itself also change. I would like the cameras to be in Favorites but not the "on/off" button. I can do this with my Nest integration (via Starling) but not on this. I can disable the on/off switches inside Homebridge for now, but not sure if this is intended implementation.

'undefined' rtsp stream URL

I have an issue with RTSP stream URL. Hostname/IP appears as undefined. Video stream will not work but still image does.

image

image

Marking Devices as Favorites and Naming Questions

Hello @hjdhjd - Thank you very much for creating this plugin for Homebridge. It is by far the most robust UniFi Protect to HomeKit integration I have used (and I have tried them all) for any automation platform. Well done! 👍

I'm hoping you can help me with the following:

  1. I seem to be having an issue with marking a camera as a favorite. When the camera is marked, it displays correctly on the Home app screen but the accessories (motion sensor, sensor switch) appear too. I tried overriding it by going into each individual accessory and unchecking this option but it reverts back to the previous state. This happens regardless of the grouped or single tile display. Can this be fixed?

  2. Would it be possible to name each of the accessories in the configuration? I would prefer to use different names in HomeKit vs what I use in UniFi Protect (including the displayed accessories). I know you are able to change the names in Homebridge but that does not flow through to HomeKit. Maybe it could be done by device.mac address as you do with the other functions?

Thanks again for all your efforts!

Best regards,
Rodney

I added new camera to Protect and got these errors, had to restart the plugin to get the new camera recognized by the plugin / added to HOME.

Plugin (homebridge-unifi-protect2 v3.1.3)

(node:16903) UnhandledPromiseRejectionWarning: Error: Accessories must be created with a non-empty displayName.
at new Accessory (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:230:29)
at new PlatformAccessory (/usr/lib/node_modules/homebridge/src/platformAccessory.ts:69:9)
at ProtectNvr.discoverAndSyncAccessories (/usr/lib/node_modules/homebridge-unifi-protect2/src/protect-nvr.ts:120:21)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at ProtectNvr.updateAccessories (/usr/lib/node_modules/homebridge-unifi-protect2/src/protect-nvr.ts:203:5)
at Timeout._onTimeout (/usr/lib/node_modules/homebridge-unifi-protect2/src/protect-nvr.ts:371:7)
(node:16903) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:16903) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Centos install no streaming video

On a Centos install with working ffmpeg (streaming video in Camera FFmpegplugin) the stream is not working. This is what is in the log:

[8/26/2020, 8:47:18 PM] [UniFi Protect] NVR Office [UCK-G2-PLUS] Frontdoor [UVC G3 Pro]: Adding camera to HomeKit.
[8/26/2020, 8:47:18 PM] [UniFi Protect] NVR Office [UCK-G2-PLUS] Driveway [UVC G3 Pro]: Adding camera to HomeKit.
[8/26/2020, 8:47:18 PM] [UniFi Protect] NVR Office [UCK-G2-PLUS] Frontdoor [UVC G3 Pro]: Stream quality configured: High.
[8/26/2020, 8:47:18 PM] [UniFi Protect] NVR Office [UCK-G2-PLUS] Driveway [UVC G3 Pro]: Stream quality configured: High.
[8/26/2020, 8:48:03 PM] [UniFi Protect] Driveway: HomeKit video stream request received: 1280x720, 30 fps, 299 kbps.
[8/26/2020, 8:48:32 PM] [UniFi Protect] Driveway: Stopped video stream.

The iPhone displays the still image with in white the text "No Response This camera is not responding"

Any tips?

Doorbell contact sensor question.

Love everything you have done here. Works great.
So right now if someone presses the doorbell button I get a rich notification on my Apple TV (running the beta and it works great). My question is.... Unless I missed it. Is there a way to get the same notification for motion detection? I seem to have the problem of %50 of the people decide to knock on the door instead of push the button. So I thought it would be great if there was a way to have motion detection activate the doorbell contact sensor to get the same effect. Not sure if this is possible or if there is a better way to do this. I love getting the snapshot on my Apple TV when some presses the button it’s unobtrusive. Would love it even more if there was a toggle or a way to get it for motion instead or as well. Many thanks. I also have the G4 doorbell and a Cloudkey Gen2 not sure if that matters.

Camera added to home but No Response

Hi All,

I have just added your plugin to my hoobs install, yet the camera says no response in home. could you please help my config is below

{
"server": {
"port": 80,
"origin": "*",
"autostart": 0,
"home_setup_id": "X-HM://0023ISWTE6BP3",
"polling_seconds": 5
},
"client": {
"default_route": "status",
"inactive_logoff": 30,
"theme": "hoobs-light",
"locale": "en",
"temp_units": "fahrenheit",
"country_code": "US",
"postal_code": "94040"
},
"bridge": {
"name": "HOOBS",
"port": 51826,
"pin": "031-42-434",
"username": "9A:10:24:B3:AF:E9"
},
"description": "",
"ports": {},
"accessories": [],
"platforms": [
{
"platform": "webostv",
"devices": [
{
"name": "Bedroom TV",
"ip": "192.168.1.99",
"mac": "78:5D:C8:63:37:D0",
"pollingInterval": 10,
"keyFile": "/.hoobs/etc/lgtvKeyFile",
"prefsDir": "
/.hoobs/etc/.webosTv",
"tvService": true,
"volumeControl": false,
"channelControl": false,
"mediaControl": false,
"inputs": [
{
"appId": "com.webos.app.hdmi1",
"name": "HDMI 1"
},
{
"appId": "com.webos.app.hdmi2",
"name": "HDMI 2"
},
{
"appId": "com.webos.app.hdmi3",
"name": "HDMI 3"
},
{
"appId": "com.disney.disneyplus-prod",
"name": "Disney Plus"
},
{
"appId": "netflix",
"name": "Netflix"
}
]
},
{
"name": "My Bedroom TV",
"ip": "192.168.1.98",
"mac": "78:5D:C8:7D:E9:7D",
"pollingInterval": 10,
"keyFile": "/.hoobs/etc/lgtvKeyFile",
"prefsDir": "
/.hoobs/etc/.webosTv",
"tvService": true,
"volumeControl": false,
"channelControl": false,
"mediaControl": false,
"inputs": [
{
"appId": "com.webos.app.hdmi1",
"name": "HDMI 1"
},
{
"appId": "com.webos.app.hdmi2",
"name": "HDMI 2"
},
{
"appId": "com.webos.app.hdmi3",
"name": "HDMI 3"
},
{
"appId": "netflix",
"name": "Netflix"
}
]
}
],
"plugin_map": {
"plugin_name": "homebridge-webos-tv"
}
},
{
"platform": "Camera-UniFi-Protect",
"plugin_map": {
"plugin_name": "homebridge-unifi-protect2"
},
"name": "UniFi Protect",
"videoProcessor": "ffmpeg",
"debugProtect": false,
"controllers": [
{
"url": "192.168.1.1",
"username": "MY NAME",
"password": "PASS WORD"
}
]
},
{
"platform": "Camera-ffmpeg",
"plugin_map": {
"plugin_name": "homebridge-camera-ffmpeg"
},
"cameras": []
}
]
}

Unable to stream live feed from UniFi cameras to Home app

First of all, thank you so much @hjdhjd for maintaining this plugin. The docs are great and installation was a breeze for me last night.

I've got two cameras in my UniFi Protect setup (G3 Micro & G4 Doorbell) and was able to successful add them both to HomeKit last night by installing HomeBridge along with this plugin on my Pi.

Image snapshots are working great - Every time I launch Home app, I see the latest still snapshots from both of my cameras.

However I can't get the live feed to work from the Home app. If I tap into either camera in the Home app, it spins for about ~30s then fails with "This camera is not responding".

I took a look at HomeBridge's logs and this is the only output from them:

[8/19/2020, 11:56:05] [UniFi Protect] Garage: HomeKit video stream request received: 1280x720, 30 fps, 299 kbps.
[8/19/2020, 11:56:35] [UniFi Protect] Garage: Stopped video stream.

FWIW the UniFi Protect iOS app is able to stream video and I can also directly stream from the Camera's RTSP URL by visiting that URL in VLC.

Any idea why Home app is unable to stream the video feed?

homebridge v1.1.2
homebridge-unifi-protect2 v3.3.2
UniFi Protect Controller v1.13.4
UniFi Protect Web UI v1.22.2
UniFi G4Doorbell/G3Micro firmware v4.26.12

No response in the Home app

Recently had to remove and re-add the cameras from the Home app since I had to reset my UniFi Cloud Key and start from scratch. Unfortunately this has broken something and though cameras are detected by the plugin and added to the Home app, they are showing as "No Response".

Homebridge is showing that the plugin is taking snapshots.

[10/30/2019, 3:00:30 AM] [UniFi Protect] Snapshot from Driveway at 480x270                            
[10/30/2019, 3:00:59 AM] [UniFi Protect] Snapshot from Kitchen at 480x270                             
[10/30/2019, 3:02:10 AM] [UniFi Protect] Snapshot from Driveway at 480x270                            
[10/30/2019, 3:02:22 AM] [UniFi Protect] Snapshot from Kitchen at 480x270                             
[10/30/2019, 3:03:50 AM] [UniFi Protect] Snapshot from Driveway at 480x270                            
[10/30/2019, 3:03:52 AM] [UniFi Protect] Snapshot from Kitchen at 480x270  

But ffmpeg is unable to steam.

[10/30/2019, 3:08:40 AM] [UniFi Protect] ERROR: FFmpeg exited with code 1

Home app shows:

Screenshot 2019-10-29 at 11 04 37 PM

I thought it was my homebridge installation and I had a long overdue pending transfer of my homebridge setup to another server, so decided to do that and test again. Unfortunately the same error is happening on this fresh install.

One thing I noticed in UniFi Protect and I don't know if this is new or has something to do with this error, is that the RTSP URL is no longer showing an IPv4 but IPv6 instead.

Screen Shot 2019-10-29 at 11 12 57 PM

Over LTE (Cellular) Video Streaming Optimization

I have been playing with the plug-in and the video streaming over Wi-Fi is very smooth with a loading time of few seconds. When I try it over LTE or another Wi-Fi the video streaming experience its not than smooth. The loading time is around 10 seconds when load, other times shows unavailable. Over Wi-Fi the streaming is stablished @ 1280x720, 30 fps, 299 kbps. over LTE is stablished @ 640x360, 30 fps, 132 kbps. Is there a way to optimize the over cellular experience reducing fps or kbps? Also, I tried over another Wi-Fi connection and the experience is the same as the cellular one. Not sure where the issue is... The internet connection upload is 300 Mbps with very low latency and the LTE connection is around 180 Mbps. The Protect App works perfect over LTE. Any idea?

Unexpected token < in JSON at position 1

after installation i received the following error (udm pro, protect active, 2 cameras installed)

(node:23172) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token < in JSON at position 1
at JSON.parse ()
at requestPromise.get.then.response (/usr/local/lib/node_modules/homebridge-unifi-protect2/index.js:118:32)
at tryCatcher (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/bluebird/js/release/async.js:15:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
(node:23172) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:23172) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Doorbell as a sensor to trigger automation

Thanks for integrating the G4 Doorbell camera into homebridge! I almost went back to my ring, but much happier to be using this plugin!

I'm not sure if this is a limitation of HomeKit, but is it possible to use the doorbell as a trigger for automations? From what I can see it doesn't look like that action is exposed as a sensor or switch. The camera only has the motion sensor of the camera and a switch to turn off motion sensing. Am I missing something here? I am guessing HomeKit is hiding this some how because when I ring the doorbell, HomeKit does actually notify me with a proper doorbell notification...

IMG_90C9D6C34533-1

StatusCodeError: 405

Getting this when homebridge starts up. Double checked the details to the key, no luck.

StatusCodeError: 405 and it fails to load any of the streams.

Multiple network interfaces and streaming video

I might be running into an issue on my system with multiple network interfaces. Would it be possible to include an option to define which network interface to use for streaming to homekit.

A similar option is available in the camera ffmpeg plugin by setting interfaceName in the config.

Would you take this in consideration?

Unable to Stream UDMP VLAN

I have a UDMP and the cameras are in a different VLAN. HB see the cameras but I'm getting the following error when try to stream;

[5/28/2020, 11:25:51 PM] [UniFi Protect] Snapshot from DRIVEWAY at 480:270 [5/28/2020, 11:25:51 PM] [UniFi Protect] An error occurs while making snapshot request [5/28/2020, 11:25:52 PM] [UniFi Protect] Start streaming video from DRIVEWAY with 640:360@20fps (132kBit) [5/28/2020, 11:25:52 PM] [UniFi Protect] An error occurs while making stream request [5/28/2020, 11:25:52 PM] [UniFi Protect] ERROR: FFmpeg exited with code -2

I'm wondering if the error is because the cameras are in different VLAN or its something else. There is no firewall restrictions between VLANs.

UVC G3 Flex cameras - won't go live

Hi following the last update the speed is a lot better, thank you.
I have noticed though that my 2 x UVC G3 Flex cameras don't go live whereas my G3 bullet and dome go live really quickly, settings all seem the same... any ideas?

Get Verified

I would not consider this a high priority but wanted to suggest making this a "Verified" plugin.

Homekit hangs

Hi

I'm new to all this homebridge stuff so pls excuse me if I am not clear.

I managed to install the api, and managed to see my unifi g3 cameras as accesories within homebridge. When I switched to homekit, I also managed to see these cameras as a favourite accesory.

However, the problem is homekit hangs almost immediately, when the screen shows a spinning circle on a screen that says "Loading Accessories and Scenes" and no matter how hard I tried, I couldn't change that.

Does anyone have similar issues and suggestions on how to solve this?

Thanks!

Configure HD quality

Hi, love your plugin and the fantastic rewrite. Maybe consider adding a GitHub Sponsor link 👍🏻

I've got G3 Flex cameras and the streams are all in 1280x720:

[8/5/2020, 8:18:49 AM] [UniFi Protect] Driveway: Starting video stream: 1280x720, 30 fps, 299 kbps.

How can I change that to the 1920x1080 that the camera supports? For the stream mostly, but ideally also for the snapshots.

I've tried this:

{
    "platform": "UniFi Protect",
    "debug": false,
    "controllers": [],
    "options": [
        "Enable.StreamOnly.High"
    ]
}

No RTSP channel found

Hi,

During start I get the error Message "No RTSP channel found". RTSP is enabled for 2 of my 5 cameras and for all 3 resolutions. I tested RTSP with VLC and it worked. What am I missing?

Regards
Christoph

Video Optimization.

@Sunoo - tagging you over here for #62 - figured it would be better than polluting another plugin's issues / comments thread. 😄

So...curious about your remark on -re...

Cannot connect to stream or retrieve snapshot

As per the title, I've followed the guide(s) to get this running but no success for me. I'm trying to get this running on a HOOBS (rasp pi "out of the box solution" with homebridge pre-installed) but no matter what I try I can't seem to get it to work.

RSTP stream confirmed working through VLC on local machine, unsure if its FFMPEG (guessing so) but Unifi Protect local account login works (made a specific user account for this purpose) and all of the Unifi side of things checks out.

Any help would be super appreciated!

FYI. Complete noob here, probably nothing wrong with the plugin and more my lack of understanding of what is going wrong to resolve this.

Unable to configure HOOBS for UniFi Protect 2

Hello. I have followed the instructions on the plugin page of hoobs, set the username and password as well as IP address. I’m using the udm pro for unifi protect and have tried both ip address’ with and without the port value of 7443. I’ve also tried with and without http and https. I’ve also tried pointing it to unifi.ui.com
9AA13241-0582-4937-91A0-7E4279F52A0E

Image resolution

Hi, I have two Unifi cameras a G3 Flex and G3 Pro. The image quality doesn't look great especially from the G3 Flex.

both cameras report the resolution like this:
[UniFi Protect] Start streaming video from Drive UVC G3 Flex with 1280:720@25fps (299kBit).

Should that be 1920x1080? I can't see what to configure to change that.

Thanks for the plugin.

Is there any way to modify which RTPS stream this plugin uses?

As per the title; is there any way to modify/instruct which RTSP this plugin chooses?

I am experiencing significant lag / delay issues caused by what I think is the plugin automatically going for the highest quality enabled RTSP stream whereas I would prefer it to go for the lowest or medium quality for HomeKit purposes.

I have yet to try the obvious and switching those higher quality RTSP streams off but I am using them for another project where the higher quality streams is desired.

Any help is greatly appreciated!

Getting promise errors in log when using "disable" feature to disable a specific camera

When attempting to use the disable feature, I start to see UnhandledPromiseRejectionWarning in the log.

Configuration reads (params obfuscated):

        {
            "platform": "UniFi Protect",
            "options": [
                    "Disable.FCECDA123456"
            ],
            "controllers": [
                {
                    "address": "172.16.99.5",
                    "name": "UniNVR",
                    "password": "somelongpassphraseabout30charslong",
                    "username": "homebridge"
                }
            ]
        }

When I add the options section I get the errors below, when I remove them they go away. I've tried lower case disable as well, same effect.

(node:4353) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'accessory' of undefined
    at WebSocket.<anonymous> (/usr/local/lib/node_modules/homebridge-unifi-protect2/src/protect-nvr.ts:264:62)
    at WebSocket.emit (events.js:311:20)
    at Receiver.receiverOnMessage (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/websocket.js:797:20)
    at Receiver.emit (events.js:311:20)
    at Receiver.dataMessage (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/receiver.js:437:14)
    at Receiver.getData (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/receiver.js:367:17)
    at Receiver.startLoop (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/receiver.js:143:22)
    at Receiver._write (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/receiver.js:78:10)
    at doWrite (_stream_writable.js:441:12)
    at writeOrBuffer (_stream_writable.js:425:5)
    at Receiver.Writable.write (_stream_writable.js:316:11)
    at TLSSocket.socketOnData (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/websocket.js:872:35)
    at TLSSocket.emit (events.js:311:20)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at TLSSocket.Readable.push (_stream_readable.js:209:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)
(node:4353) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4353) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:4353) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'accessory' of undefined
    at WebSocket.<anonymous> (/usr/local/lib/node_modules/homebridge-unifi-protect2/src/protect-nvr.ts:264:62)
    at WebSocket.emit (events.js:311:20)
    at Receiver.receiverOnMessage (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/websocket.js:797:20)
    at Receiver.emit (events.js:311:20)
    at Receiver.dataMessage (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/receiver.js:437:14)
    at Receiver.getData (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/receiver.js:367:17)
    at Receiver.startLoop (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/receiver.js:143:22)
    at Receiver._write (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/receiver.js:78:10)
    at doWrite (_stream_writable.js:441:12)
    at writeOrBuffer (_stream_writable.js:425:5)
    at Receiver.Writable.write (_stream_writable.js:316:11)
    at TLSSocket.socketOnData (/usr/local/lib/node_modules/homebridge-unifi-protect2/node_modules/ws/lib/websocket.js:872:35)
    at TLSSocket.emit (events.js:311:20)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at TLSSocket.Readable.push (_stream_readable.js:209:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)
(node:4353) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

No Audio

Great job on the plugin, I'm running homebridge on a 2018 MacMini and got this working no problem, however, there's no audio...is that by design or is there something I can troubleshoot?

Adding ability for external triggers.

@hjdhjd , Wow. This is the first and only homebridge plugin that takes full advantage of UniFi. Great work.

I had a request for enhancement, that is low priority. Would it be possible to add a parameter to add a switch for external trigger of motion events? I know not everyone would use this and I agree with your mindset of keeping things simple and hidden unless things are needed.

Here is the scenario: I have a door contact sensor on my mailbox. This is right by the street and far out of my motion zones to avoid headlights. I would like to get an image notification when it is opened. This way I know if it is the mailman, or my wife has already retrieved the mail.

Again, thank you so much for the hard work and such a polished result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.