beele / homebridge-unifi-protect-camera-motion

Camera & Motion sensor support for Unifi Protect cameras in Homekit via Homebridge
Apache License 2.0
103 stars 12 forks source link

Issue installing plugin #6

Closed alezanott closed 4 years ago

alezanott commented 4 years ago

@beele I'm currently running homebridge on HOOBS. I've tried to install the version 0.0.6 but got this error: npm WARN tar ENOENT: no such file or directory, open '/usr/local/lib/node_modules/.staging/homebridge-unifi-protect-camera-motion-5fbbbe69/resources/models/coco/mobilenet_v2/group1-shard3of17' npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at: npm ERR! https://npm.community [ ...........] \ extract:homebridge-unifi-protect-camera-motion: verb loc npm ERR! A complete log of this run can be found in: npm ERR! /home/hoobs/.npm/_logs/2019-12-21T14_27_57_544Z-debug.log [ ...........] \ extract:homebridge-unifi-protect-camera-motion: verb loc Command failed. Please review log for details.

@tensorflow/tfjs-node@1.5.1 install /usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/@tensorflow/tfjs-node node scripts/install.js

CPU-linux-1.5.1.tar.gz

canvas@2.6.1 install /usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v64-linux-glibc-arm.tar.gz node-pre-gyp WARN Pre-built binaries not found for canvas@2.6.1 and node@10.16.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) Package pixman-1 was not found in the pkg-config search path. Perhaps you should add the directory containing pixman-1.pc' to the PKG_CONFIG_PATH environment variable No package 'pixman-1' found gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error:gypfailed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16) gyp ERR! stack at ChildProcess.emit (events.js:198:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Linux 4.19.58-v7+ gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas/build/Release" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64" gyp ERR! cwd /usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas gyp ERR! node -v v10.16.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas/build/Release --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:198:13) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:982:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) node-pre-gyp ERR! System Linux 4.19.58-v7+ node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas node-pre-gyp ERR! node -v v10.16.0 node-pre-gyp ERR! node-pre-gyp -v v0.11.0 node-pre-gyp ERR! not ok Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/node_modules/canvas/build/Release --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! canvas@2.6.1 install:node-pre-gyp install --fallback-to-build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the canvas@2.6.1 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/hoobs/.npm/_logs/2019-12-21T14_29_12_159Z-debug.log

beele commented 4 years ago

On what hardware are you trying to run this?

alezanott commented 4 years ago

On what hardware are you trying to run this? @beele I'm running it on a Raspberry model 3 B+. OS: HOOBS

beele commented 4 years ago

Have you installed the extra dependencies for rbpi? See: https://github.com/Automattic/node-canvas#compiling as described in the readme

alezanott commented 4 years ago

Have you installed the extra dependencies for rbpi? See: https://github.com/Automattic/node-canvas#compiling as described in the readme

@beele I've installed them. I get this error when running the whole configuration.

Cannot find module '/home/hoobs/.hoobs/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node'
Require stack:
- /home/hoobs/.hoobs/node_modules/@tensorflow/tfjs-node/dist/index.js
- /home/hoobs/.hoobs/node_modules/homebridge-unifi-protect-camera-motion/src/coco/coco.js
- /home/hoobs/.hoobs/node_modules/homebridge-unifi-protect-camera-motion/src/coco/loader.js
- /home/hoobs/.hoobs/node_modules/homebridge-unifi-protect-camera-motion/src/motion/motion.js
- /home/hoobs/.hoobs/node_modules/homebridge-unifi-protect-camera-motion/src/index.js
- /home/hoobs/.hoobs/lib/plugins.js
- /home/hoobs/.hoobs/lib/controllers/system.js
- /home/hoobs/.hoobs/lib/api.js
- /home/hoobs/.hoobs/lib/cli.js
- /usr/local/lib/node_modules/@hoobs/hoobs/scripts/loader.js
- /usr/local/lib/node_modules/@hoobs/hoobs/bin/hoobs
beele commented 4 years ago

For some reason the tfjs-node is not installed (or not installed correctly) Maybe you can try installing the dependency manually so it is available under the path it is looking for. Could this be related to hoobs?

beele commented 4 years ago

@alezanott Can you try by removing and reinstalling the plugin. I've made some updates in the latest version that should fix these issues.

alezanott commented 4 years ago

@alezanott Can you try by removing and reinstalling the plugin. I've made some updates in the latest version that should fix these issues.

@beele Thank you for the support! I've tried before a manual install of dependencies but nothing changed. I've reinstalled the HOOBS OS on my rpi, then installed the fresh version 0.0.9 but still with some errors. I think that something is missing on HOOBS, or maybe some directories cannot talk to each other... `

canvas@2.6.1 install /home/hoobs/.hoobs/node_modules/canvas node-pre-gyp install --fallback-to-build node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v72-linux-glibc-arm.tar.gz node-pre-gyp WARN Pre-built binaries not found for canvas@2.6.1 and node@12.13.1 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) Package pixman-1 was not found in the pkg-config search path. Perhaps you should add the directory containing 'pixman-1.pc' to the PKG_CONFIG_PATH environment variable No package 'pixman-1' found gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: 'gyp' failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16) gyp ERR! stack at ChildProcess.emit (events.js:210:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Linux 4.19.75-v7+ gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/hoobs/.hoobs/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/hoobs/.hoobs/node_modules/canvas/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72" gyp ERR! cwd /home/hoobs/.hoobs/node_modules/canvas gyp ERR! node -v v12.13.1 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/hoobs/.hoobs/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/hoobs/.hoobs/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1) node-pre-gyp ERR! stack at ChildProcess. (/home/hoobs/.hoobs/node_modules/canvas/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:210:5) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) node-pre-gyp ERR! System Linux 4.19.75-v7+ node-pre-gyp ERR! command "/usr/local/bin/node" "/home/hoobs/.hoobs/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /home/hoobs/.hoobs/node_modules/canvas node-pre-gyp ERR! node -v v12.13.1 node-pre-gyp ERR! node-pre-gyp -v v0.11.0 node-pre-gyp ERR! not ok Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/hoobs/.hoobs/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/hoobs/.hoobs/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! canvas@2.6.1 install: 'node-pre-gyp install --fallback-to-build' npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the canvas@2.6.1 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/hoobs/.npm/_logs/2020-02-05T09_04_08_748Z-debug.log `

If you want I can send you the full log file of the error.

beele commented 4 years ago

I've recently upgraded to a pi4. I'll try to install hoobs on my old pi3 and see why this does not work. Give me a few days ;)

nicgraner commented 4 years ago

Can also confirm this is happening, not just on HOOBs, but also just base raspbian for me as well as another homebridge instance I was running in docker on unraid, however I think that was an issue it was having with FFMPEG more than this plugin. happy to give any info needed! Thanks for your work :)

beele commented 4 years ago

@alezanott I see that hoobs doesn't install homebridge as a global package (and my install instructions do install the plugin globally). This could be an issue. (normally the global node_modules folder is under /usr/local/lib/) Try this:

@nicgraner can you see where your homebridge is installed. Is it under /usr/local/lib/node_modules/ or another folder?

alezanott commented 4 years ago

@alezanott I see that hoobs doesn't install homebridge as a global package (and my install instructions do install the plugin globally). This could be an issue. (normally the global node_modules folder is under /usr/local/lib/) Try this:

  • cd into /home/hoobs/.hoobs/
  • Try installing the plugin so that it appears under /home/hoobs/.hoobs/node_modules/ ==> npm install homebridge-unifi-protect-camera-motion --unsafe-perm=true (add sudo if an error occurs and try again, but should not be needed for local packages)

@nicgraner can you see where your homebridge is installed. Is it under /usr/local/lib/node_modules/ or another folder?

@beele thank you for the support! I've just tried installing it under that directory but I got the same output error. Tried even installing it with sudo but nothing changed as expected.

beele commented 4 years ago

I tried this on my PI3 with a fresh Hoobs install:

alezanott commented 4 years ago

I tried this on my PI3 with a fresh Hoobs install:

  • Hoobs zip (latest version) to SD card via etcher
  • Booted pi and set up wireless connection via the hoobs hotspot
  • SSH'ed into the pi and installed the node-canvas dependencies manually (sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev)
  • made and installed ffmpeg (when ssh-ing into the device create a new sh file and paste: https://github.com/beele/homebridge-unifi-protect-camera-motion/blob/master/resources/scripts/compile-ffmpeg.sh into it. For some reason the included script will not execute correctly, not even when run with sudo)
  • Opened the Hoobs web interface
  • Installed the plugin by searching for it (V0.0.9)
  • Set the correct config in the UI
  • Checked the log ==> fully working

@beele Thank you! It did work great! Now the only problem is that on my home app the motion sensor don't show up. I we got right now 5 uvc g3 and 1 flex cameras connected to my protect, none of this appears as a motion sensor on the home app (I remember that on another previous version of the plugin they worked as motion sensor). I can see from the log of HOOBS that the motion sensor register many motion events, so I think that on the HOOBS part everything is working fine.

I have now enabled only one RTSP stream that is the only one that I really need, just copied and pasted the RTSP stream without the "string with random characters" and works fine.

beele commented 4 years ago

@alezanott The camera contains the motion sensor. Since ios13 these are grouped. If you open the camera view (so the livestream will start), click on the settings icon and pick "Show as Separate Tiles". The motion sensor shoud then show up as a seprate tile in the Home app.

alezanott commented 4 years ago

@alezanott The camera contains the motion sensor. Since ios13 these are grouped. If you open the camera view (so the livestream will start), click on the settings icon and pick "Show as Separate Tiles". The motion sensor shoud then show up as a seprate tile in the Home app.

@beele It did work for the separation, but still no activation of the motion sensor. I've even tried with a motion score of 30, but still nothing...

beele commented 4 years ago

@alezanott Ok. are you using the regular or enhanced (tensorflow based) motion detection?

alezanott commented 4 years ago

@alezanott Ok. are you using the regular or enhanced (tensorflow based) motion detection?

@beele just the regular one. I've disabled the tensorflow based one

beele commented 4 years ago

@alezanott Hmm weird, I checked the code but cannot see an issue directly with that flow (since it's much simpler). Could you post some logs from homebridge?

nicgraner commented 4 years ago

FWIW I am also having similar issues (the Motion event is triggered in the log, but never getting any sort of notification on the homekit side of things) seen in code here:


[Homebridge] [2/10/2020, 12:10:55 PM] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e41aab401cb291d13008dbe) accepted for camera: Stairs - Score: 77 !!!!
[Homebridge] [2/10/2020, 12:11:10 PM] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e41aacd026c291d13008dc1) rejected for camera: Stairs - Score: 0 !!!!
[Homebridge] [2/10/2020, 12:11:15 PM] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e41aacd026c291d13008dc1) accepted for camera: Stairs - Score: 81 !!!!
[Homebridge] [2/10/2020, 12:11:20 PM] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e41aacd026c291d13008dc1) accepted for camera: Stairs - Score: 89 !!!!
[Homebridge] [2/10/2020, 12:11:25 PM] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e41aacd026c291d13008dc1) accepted for camera: Stairs - Score: 89 !!!!```

Im not sure if it's something I need to enable somehwere, but I have notifications enabled for homekit in iOS settings, and checked everywhere I could think to. The motion sensor says ready, notifications are set to always, and the homebridge logs say that its receiving the motion events. Any insight would be appreciated :)
beele commented 4 years ago

@nicgraner & @alezanott I've switched back to the basic motion events on my setup and they're working.

Make sure you have notifications for cameras/motion sensors enabled in the main Home App settings (via the house icon in the Home app) Also make sure you have notifications enabled in the settings for each camera. (via opening the camera and going to it's settings)

Like so: IMG_F58C1184C827-1 IMG_CA0D3B6CDD69-1

alezanott commented 4 years ago

I've switched back to the basic motion events on my setup and they're working.

Make sure you have notifications for cameras/motion sensors enabled in the main Home App settings (via the house icon in the Home app) Also make sure you have notifications enabled in the settings for each camera. (via opening the camera and going to it's settings)

Like so: IMG_F58C1184C827-1 IMG_CA0D3B6CDD69-1

@beele I've checked on my home app and all the notifications are enabled correctly. Here I post a log of:

[Homebridge] [2/10/2020, 21:43:23] [Unifi protect cameras & motion sensors] Motion detected inside of skippable timeframe, ignoring!
[Homebridge] [2/10/2020, 21:45:33] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e41c0eb03674d03e700cfe8) accepted for camera: Entrata Garage - Score: 69 !!!!
[Homebridge] [2/10/2020, 21:45:38] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e41c0eb03674d03e700cfe8) accepted for camera: Entrata Garage - Score: 69 !!!!
[Homebridge] [2/10/2020, 21:45:43] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e41c0eb03674d03e700cfe8) accepted for camera: Entrata Garage - Score: 69 !!!!
beele commented 4 years ago

@nicgraner & @alezanott The motion events seem not to be matching up with accessories. I've made released a debug build on NPM which you could install, it will print out more logging, that hopefully allows us to see what is going wrong.

homebridge-unifi-protect-camera-motion @ 0.1.0-debug (or just the latest version)

Edit: Could you also give your motion_interval and motion_repeat_interval values from the config.

alezanott commented 4 years ago

@nicgraner & @alezanott The motion events seem not to be matching up with accessories. I've made released a debug build on NPM which you could install, it will print out more logging, that hopefully allows us to see what is going wrong.

homebridge-unifi-protect-camera-motion @ 0.1.0-debug (or just the latest version)

Edit: Could you also give your motion_interval and motion_repeat_interval values from the config.

@beele My motion_interval is set to 5000, the motion_repeat_interval is set to 30000

This is the log when enabled debug and updated to the latest version:

[Homebridge] [2/11/2020, 09:34:11] Loaded config.json with 0 accessories and 1 platforms.[Homebridge] [2/11/2020, 09:34:15] Loaded plugin: "homebridge-unifi-protect-camera-motion"[Homebridge] [2/11/2020, 09:34:15] Registering platform "homebridge-unifi-protect-camera-motion.Unifi-Protect-Camera-Motion"[Homebridge] [2/11/2020, 09:34:15] Loading 1 platforms...[Homebridge] [2/11/2020, 09:34:15] [Unifi protect cameras & motion sensors] Initializing Unifi-Protect-Camera-Motion platform...[Homebridge] [2/11/2020, 09:34:15] Loading 0 accessories...[Homebridge] [2/11/2020, 09:34:15] [Unifi protect cameras & motion sensors] WARNING: No previous session found, a new session must be created![Homebridge] [2/11/2020, 09:34:15] API launched[Homebridge] [2/11/2020, 09:34:15] Service is running on port 51826.[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] Authenticated, returning session[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] Cameras retrieved, enumerating motion sensors[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] {
  isDeleting: false,
  mac: 'B4FBE49E52D5',
  host: '192.168.1.25',
  connectionHost: '192.168.1.1',
  type: 'UVC G3 Flex',
  name: 'Entrata Porta',
  upSince: 1579797857308,
  lastSeen: 1581410038505,
  connectedSince: 1580844137172,
  state: 'CONNECTED',
  hardwareRevision: '8',
  firmwareVersion: '4.18.37',
  firmwareBuild: '3fcdcec.191223.613',
  isUpdating: false,
  isAdopting: false,
  isManaged: true,
  isProvisioned: true,
  isRebooting: false,
  isSshEnabled: false,
  canManage: false,
  isHidden: false,
  lastMotion: 1581407087696,
  micVolume: 100,
  isMicEnabled: true,
  isRecording: true,
  isMotionDetected: false,
  isAttemptingToConnect: false,
  phyRate: 100,
  hdrMode: false,
  isProbingForWifi: false,
  apMac: null,
  apRssi: null,
  elementInfo: null,
  chimeDuration: 300,
  isDark: false,
  motionStartCalls: 0,
  lastRing: null,
  wiredConnectionState: { phyRate: 100 },
  channels: [
    {
      id: 0,
      name: 'High',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1920,
      height: 1080,
      fps: 25,
      bitrate: 6000000,
      minBitrate: 750000,
      maxBitrate: 6000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 1,
      name: 'Medium',
      enabled: true,
      isRtspEnabled: true,
      rtspAlias: 'MeXmJyC57ekkySNM',
      width: 1024,
      height: 576,
      fps: 15,
      bitrate: 1200000,
      minBitrate: 750000,
      maxBitrate: 2000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 2,
      name: 'Low',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 640,
      height: 360,
      fps: 15,
      bitrate: 200000,
      minBitrate: 32000,
      maxBitrate: 1000000,
      fpsValues: [Array],
      idrInterval: 5
    }
  ],
  ispSettings: {
    aeMode: 'auto',
    irLedMode: 'auto',
    irLedLevel: 255,
    wdr: 1,
    icrSensitivity: 0,
    brightness: 50,
    contrast: 50,
    hue: 50,
    saturation: 50,
    sharpness: 50,
    denoise: 50,
    isFlippedVertical: false,
    isFlippedHorizontal: false,
    isAutoRotateEnabled: true,
    isLdcEnabled: true,
    is3dnrEnabled: true,
    isExternalIrEnabled: false,
    isAggressiveAntiFlickerEnabled: false,
    isPauseMotionEnabled: false,
    dZoomCenterX: 50,
    dZoomCenterY: 50,
    dZoomScale: 0,
    dZoomStreamId: 4,
    focusMode: 'ztrig',
    focusPosition: 0,
    touchFocusX: 0,
    touchFocusY: 0,
    zoomPosition: 0
  },
  talkbackSettings: {
    typeFmt: 'aac',
    typeIn: 'serverudp',
    bindAddr: '0.0.0.0',
    bindPort: 7004,
    filterAddr: null,
    filterPort: null,
    channels: 1,
    samplingRate: 22050,
    bitsPerSample: 16,
    quality: 100
  },
  osdSettings: {
    isNameEnabled: false,
    isDateEnabled: true,
    isLogoEnabled: false,
    isDebugEnabled: false
  },
  ledSettings: { isEnabled: false, blinkRate: 0 },
  speakerSettings: { isEnabled: true, areSystemSoundsEnabled: false, volume: 80 },
  recordingSettings: {
    prePaddingSecs: 2,
    postPaddingSecs: 2,
    minMotionEventTrigger: 1000,
    endMotionEventDelay: 3000,
    suppressIlluminationSurge: false,
    mode: 'always',
    geofencing: 'off',
    useNewMotionAlgorithm: false,
    enablePirTimelapse: false
  },
  recordingSchedule: null,
  motionZones: [
    {
      name: 'New Zone',
      color: '#586CED',
      points: [Array],
      sensitivity: 70
    }
  ],
  privacyZones: [],
  stats: {
    rxBytes: 12585706294,
    txBytes: 246788774948,
    wifi: {
      channel: null,
      frequency: null,
      linkSpeedMbps: null,
      signalQuality: 50,
      signalStrength: 0
    },
    battery: { percentage: null, isCharging: false, sleepState: 'awake' },
    video: {
      recordingStart: 1580109581100,
      recordingEnd: 1581410052143,
      recordingStartLQ: 1580106691055,
      recordingEndLQ: 1581410052145,
      timelapseStart: 1579889347379,
      timelapseEnd: 1581409542174,
      timelapseStartLQ: 1579889347379,
      timelapseEndLQ: 1581408672141
    },
    wifiQuality: 50,
    wifiStrength: 0
  },
  featureFlags: {
    canAdjustIrLedLevel: false,
    canMagicZoom: false,
    canOpticalZoom: false,
    canTouchFocus: false,
    hasAccelerometer: true,
    hasAec: false,
    hasBattery: false,
    hasBluetooth: false,
    hasChime: false,
    hasExternalIr: false,
    hasIcrSensitivity: true,
    hasLdc: true,
    hasLedIr: true,
    hasLedStatus: true,
    hasLineIn: false,
    hasMic: true,
    hasPrivacyMask: true,
    hasRtc: false,
    hasSdCard: false,
    hasSpeaker: false,
    hasWifi: false,
    hasHdr: true,
    hasAutoICROnly: true,
    hasMotionZones: true
  },
  pirSettings: {
    pirSensitivity: 100,
    pirMotionClipLength: 15,
    timelapseFrameInterval: 15,
    timelapseTransferInterval: 600
  },
  wifiConnectionState: {
    channel: null,
    frequency: null,
    phyRate: null,
    signalQuality: null,
    signalStrength: null
  },
  id: '5e2b32aa032d3e03e70003f2',
  isConnected: true,
  platform: 's2l',
  hasSpeaker: false,
  hasWifi: false,
  audioBitrate: 64000,
  modelKey: 'camera'
}[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] {
  isDeleting: false,
  mac: 'FCECDAD9BAAE',
  host: '192.168.1.30',
  connectionHost: '192.168.1.1',
  type: 'UVC G3',
  name: 'Garage',
  upSince: 1579110806427,
  lastSeen: 1581410038464,
  connectedSince: 1580844136766,
  state: 'CONNECTED',
  hardwareRevision: '22',
  firmwareVersion: '4.18.37',
  firmwareBuild: '3fcdcec.191223.613',
  isUpdating: false,
  isAdopting: false,
  isManaged: true,
  isProvisioned: true,
  isRebooting: false,
  isSshEnabled: false,
  canManage: false,
  isHidden: false,
  lastMotion: 1581409496295,
  micVolume: 100,
  isMicEnabled: true,
  isRecording: true,
  isMotionDetected: false,
  isAttemptingToConnect: false,
  phyRate: 100,
  hdrMode: false,
  isProbingForWifi: null,
  apMac: null,
  apRssi: null,
  elementInfo: null,
  chimeDuration: 300,
  isDark: false,
  motionStartCalls: 0,
  lastRing: null,
  wiredConnectionState: { phyRate: 100 },
  channels: [
    {
      id: 0,
      name: 'High',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1920,
      height: 1080,
      fps: 30,
      bitrate: 6000000,
      minBitrate: 750000,
      maxBitrate: 6000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 1,
      name: 'Medium',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1024,
      height: 576,
      fps: 15,
      bitrate: 1200000,
      minBitrate: 750000,
      maxBitrate: 2000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 2,
      name: 'Low',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 640,
      height: 360,
      fps: 15,
      bitrate: 200000,
      minBitrate: 32000,
      maxBitrate: 1000000,
      fpsValues: [Array],
      idrInterval: 5
    }
  ],
  ispSettings: {
    aeMode: 'auto',
    irLedMode: 'auto',
    irLedLevel: 255,
    wdr: 2,
    icrSensitivity: 0,
    brightness: 50,
    contrast: 58,
    hue: 50,
    saturation: 58,
    sharpness: 54,
    denoise: 50,
    isFlippedVertical: false,
    isFlippedHorizontal: false,
    isAutoRotateEnabled: false,
    isLdcEnabled: true,
    is3dnrEnabled: true,
    isExternalIrEnabled: false,
    isAggressiveAntiFlickerEnabled: false,
    isPauseMotionEnabled: false,
    dZoomCenterX: 50,
    dZoomCenterY: 50,
    dZoomScale: 0,
    dZoomStreamId: 4,
    focusMode: 'ztrig',
    focusPosition: 0,
    touchFocusX: 0,
    touchFocusY: 0,
    zoomPosition: 0
  },
  talkbackSettings: {
    typeFmt: 'aac',
    typeIn: 'serverudp',
    bindAddr: '0.0.0.0',
    bindPort: 7004,
    filterAddr: null,
    filterPort: null,
    channels: 1,
    samplingRate: 22050,
    bitsPerSample: 16,
    quality: 100
  },
  osdSettings: {
    isNameEnabled: false,
    isDateEnabled: true,
    isLogoEnabled: false,
    isDebugEnabled: false
  },
  ledSettings: { isEnabled: false, blinkRate: 0 },
  speakerSettings: { isEnabled: true, areSystemSoundsEnabled: false, volume: 80 },
  recordingSettings: {
    prePaddingSecs: 2,
    postPaddingSecs: 2,
    minMotionEventTrigger: 1000,
    endMotionEventDelay: 3000,
    suppressIlluminationSurge: false,
    mode: 'always',
    geofencing: 'off',
    useNewMotionAlgorithm: false,
    enablePirTimelapse: false
  },
  recordingSchedule: null,
  motionZones: [
    {
      name: 'Default',
      color: '#AB46BC',
      points: [Array],
      sensitivity: 70
    },
    {
      name: 'New Zone',
      color: '#586CED',
      points: [Array],
      sensitivity: 85
    },
    {
      name: 'New Zone',
      color: '#84D9FF',
      points: [Array],
      sensitivity: 85
    },
    {
      name: 'New Zone',
      color: '#19DDCC',
      points: [Array],
      sensitivity: 90
    }
  ],
  privacyZones: [],
  stats: {
    rxBytes: 24322774115,
    txBytes: 991503803672,
    wifi: {
      channel: null,
      frequency: null,
      linkSpeedMbps: null,
      signalQuality: 50,
      signalStrength: 0
    },
    battery: { percentage: null, isCharging: false, sleepState: 'awake' },
    video: {
      recordingStart: 1580113018679,
      recordingEnd: 1581410052925,
      recordingStartLQ: 1580106623931,
      recordingEndLQ: 1581410052962,
      timelapseStart: 1579889345489,
      timelapseEnd: 1581409792925,
      timelapseStartLQ: 1579889345489,
      timelapseEndLQ: 1581408987975
    },
    wifiQuality: 50,
    wifiStrength: 0
  },
  featureFlags: {
    canAdjustIrLedLevel: false,
    canMagicZoom: true,
    canOpticalZoom: false,
    canTouchFocus: false,
    hasAccelerometer: false,
    hasAec: false,
    hasBattery: false,
    hasBluetooth: false,
    hasChime: false,
    hasExternalIr: true,
    hasIcrSensitivity: true,
    hasLdc: true,
    hasLedIr: true,
    hasLedStatus: false,
    hasLineIn: false,
    hasMic: true,
    hasPrivacyMask: true,
    hasRtc: false,
    hasSdCard: true,
    hasSpeaker: false,
    hasWifi: false,
    hasHdr: false,
    hasAutoICROnly: true,
    hasMotionZones: true
  },
  pirSettings: {
    pirSensitivity: 100,
    pirMotionClipLength: 15,
    timelapseFrameInterval: 15,
    timelapseTransferInterval: 600
  },
  wifiConnectionState: {
    channel: null,
    frequency: null,
    phyRate: null,
    signalQuality: null,
    signalStrength: null
  },
  id: '5e2b32aa02ae3e03e70003ee',
  isConnected: true,
  platform: 's2l',
  hasSpeaker: false,
  hasWifi: false,
  audioBitrate: 64000,
  modelKey: 'camera'
}[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] {
  isDeleting: false,
  mac: 'FCECDAD9BAB1',
  host: '192.168.1.29',
  connectionHost: '192.168.1.1',
  type: 'UVC G3',
  name: 'Entrata Modica',
  upSince: 1579110806949,
  lastSeen: 1581410038463,
  connectedSince: 1580844136845,
  state: 'CONNECTED',
  hardwareRevision: '22',
  firmwareVersion: '4.18.37',
  firmwareBuild: '3fcdcec.191223.613',
  isUpdating: false,
  isAdopting: false,
  isManaged: true,
  isProvisioned: true,
  isRebooting: false,
  isSshEnabled: false,
  canManage: false,
  isHidden: false,
  lastMotion: 1581409857264,
  micVolume: 100,
  isMicEnabled: true,
  isRecording: true,
  isMotionDetected: false,
  isAttemptingToConnect: false,
  phyRate: 100,
  hdrMode: false,
  isProbingForWifi: null,
  apMac: null,
  apRssi: null,
  elementInfo: null,
  chimeDuration: 300,
  isDark: false,
  motionStartCalls: 0,
  lastRing: null,
  wiredConnectionState: { phyRate: 100 },
  channels: [
    {
      id: 0,
      name: 'High',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1920,
      height: 1080,
      fps: 30,
      bitrate: 6000000,
      minBitrate: 750000,
      maxBitrate: 6000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 1,
      name: 'Medium',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1024,
      height: 576,
      fps: 15,
      bitrate: 1200000,
      minBitrate: 750000,
      maxBitrate: 2000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 2,
      name: 'Low',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 640,
      height: 360,
      fps: 15,
      bitrate: 200000,
      minBitrate: 32000,
      maxBitrate: 1000000,
      fpsValues: [Array],
      idrInterval: 5
    }
  ],
  ispSettings: {
    aeMode: 'auto',
    irLedMode: 'autoFilterOnly',
    irLedLevel: 255,
    wdr: 1,
    icrSensitivity: 0,
    brightness: 56,
    contrast: 58,
    hue: 50,
    saturation: 58,
    sharpness: 58,
    denoise: 66,
    isFlippedVertical: false,
    isFlippedHorizontal: false,
    isAutoRotateEnabled: false,
    isLdcEnabled: true,
    is3dnrEnabled: true,
    isExternalIrEnabled: false,
    isAggressiveAntiFlickerEnabled: false,
    isPauseMotionEnabled: false,
    dZoomCenterX: 50,
    dZoomCenterY: 50,
    dZoomScale: 0,
    dZoomStreamId: 4,
    focusMode: 'ztrig',
    focusPosition: 0,
    touchFocusX: 0,
    touchFocusY: 0,
    zoomPosition: 0
  },
  talkbackSettings: {
    typeFmt: 'aac',
    typeIn: 'serverudp',
    bindAddr: '0.0.0.0',
    bindPort: 7004,
    filterAddr: null,
    filterPort: null,
    channels: 1,
    samplingRate: 22050,
    bitsPerSample: 16,
    quality: 100
  },
  osdSettings: {
    isNameEnabled: false,
    isDateEnabled: true,
    isLogoEnabled: false,
    isDebugEnabled: false
  },
  ledSettings: { isEnabled: false, blinkRate: 0 },
  speakerSettings: { isEnabled: true, areSystemSoundsEnabled: false, volume: 80 },
  recordingSettings: {
    prePaddingSecs: 2,
    postPaddingSecs: 2,
    minMotionEventTrigger: 1000,
    endMotionEventDelay: 3000,
    suppressIlluminationSurge: false,
    mode: 'always',
    geofencing: 'off',
    useNewMotionAlgorithm: false,
    enablePirTimelapse: false
  },
  recordingSchedule: null,
  motionZones: [
    {
      name: 'Default',
      color: '#AB46BC',
      points: [Array],
      sensitivity: 75
    }
  ],
  privacyZones: [],
  stats: {
    rxBytes: 21998868392,
    txBytes: 763396365540,
    wifi: {
      channel: null,
      frequency: null,
      linkSpeedMbps: null,
      signalQuality: 50,
      signalStrength: 0
    },
    battery: { percentage: null, isCharging: false, sleepState: 'awake' },
    video: {
      recordingStart: 1580108629764,
      recordingEnd: 1581410052865,
      recordingStartLQ: 1580106584858,
      recordingEndLQ: 1581410052936,
      timelapseStart: 1579889345498,
      timelapseEnd: 1581409762914,
      timelapseStartLQ: 1579889345498,
      timelapseEndLQ: 1581408937937
    },
    wifiQuality: 50,
    wifiStrength: 0
  },
  featureFlags: {
    canAdjustIrLedLevel: false,
    canMagicZoom: true,
    canOpticalZoom: false,
    canTouchFocus: false,
    hasAccelerometer: false,
    hasAec: false,
    hasBattery: false,
    hasBluetooth: false,
    hasChime: false,
    hasExternalIr: true,
    hasIcrSensitivity: true,
    hasLdc: true,
    hasLedIr: true,
    hasLedStatus: false,
    hasLineIn: false,
    hasMic: true,
    hasPrivacyMask: true,
    hasRtc: false,
    hasSdCard: true,
    hasSpeaker: false,
    hasWifi: false,
    hasHdr: false,
    hasAutoICROnly: true,
    hasMotionZones: true
  },
  pirSettings: {
    pirSensitivity: 100,
    pirMotionClipLength: 15,
    timelapseFrameInterval: 15,
    timelapseTransferInterval: 600
  },
  wifiConnectionState: {
    channel: null,
    frequency: null,
    phyRate: null,
    signalQuality: null,
    signalStrength: null
  },
  id: '5e2b32aa02cd3e03e70003ef',
  isConnected: true,
  platform: 's2l',
  hasSpeaker: false,
  hasWifi: false,
  audioBitrate: 64000,
  modelKey: 'camera'
}[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] {
  isDeleting: false,
  mac: 'FCECDAD9B2F2',
  host: '192.168.1.28',
  connectionHost: '192.168.1.1',
  type: 'UVC G3',
  name: 'Entrata Garage',
  upSince: 1579110806652,
  lastSeen: 1581410038464,
  connectedSince: 1580844136793,
  state: 'CONNECTED',
  hardwareRevision: '22',
  firmwareVersion: '4.18.37',
  firmwareBuild: '3fcdcec.191223.613',
  isUpdating: false,
  isAdopting: false,
  isManaged: true,
  isProvisioned: true,
  isRebooting: false,
  isSshEnabled: false,
  canManage: false,
  isHidden: false,
  lastMotion: 1581409530962,
  micVolume: 100,
  isMicEnabled: true,
  isRecording: true,
  isMotionDetected: false,
  isAttemptingToConnect: false,
  phyRate: 100,
  hdrMode: false,
  isProbingForWifi: null,
  apMac: null,
  apRssi: null,
  elementInfo: null,
  chimeDuration: 300,
  isDark: false,
  motionStartCalls: 0,
  lastRing: null,
  wiredConnectionState: { phyRate: 100 },
  channels: [
    {
      id: 0,
      name: 'High',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1920,
      height: 1080,
      fps: 30,
      bitrate: 6000000,
      minBitrate: 750000,
      maxBitrate: 6000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 1,
      name: 'Medium',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1024,
      height: 576,
      fps: 15,
      bitrate: 1200000,
      minBitrate: 750000,
      maxBitrate: 2000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 2,
      name: 'Low',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 640,
      height: 360,
      fps: 15,
      bitrate: 200000,
      minBitrate: 32000,
      maxBitrate: 1000000,
      fpsValues: [Array],
      idrInterval: 5
    }
  ],
  ispSettings: {
    aeMode: 'auto',
    irLedMode: 'autoFilterOnly',
    irLedLevel: 255,
    wdr: 2,
    icrSensitivity: 0,
    brightness: 58,
    contrast: 61,
    hue: 50,
    saturation: 58,
    sharpness: 62,
    denoise: 49,
    isFlippedVertical: false,
    isFlippedHorizontal: false,
    isAutoRotateEnabled: false,
    isLdcEnabled: true,
    is3dnrEnabled: true,
    isExternalIrEnabled: false,
    isAggressiveAntiFlickerEnabled: false,
    isPauseMotionEnabled: false,
    dZoomCenterX: 50,
    dZoomCenterY: 50,
    dZoomScale: 0,
    dZoomStreamId: 4,
    focusMode: 'ztrig',
    focusPosition: 0,
    touchFocusX: 0,
    touchFocusY: 0,
    zoomPosition: 0
  },
  talkbackSettings: {
    typeFmt: 'aac',
    typeIn: 'serverudp',
    bindAddr: '0.0.0.0',
    bindPort: 7004,
    filterAddr: null,
    filterPort: null,
    channels: 1,
    samplingRate: 22050,
    bitsPerSample: 16,
    quality: 100
  },
  osdSettings: {
    isNameEnabled: false,
    isDateEnabled: true,
    isLogoEnabled: false,
    isDebugEnabled: false
  },
  ledSettings: { isEnabled: true, blinkRate: 0 },
  speakerSettings: { isEnabled: true, areSystemSoundsEnabled: false, volume: 80 },
  recordingSettings: {
    prePaddingSecs: 2,
    postPaddingSecs: 2,
    minMotionEventTrigger: 1000,
    endMotionEventDelay: 3000,
    suppressIlluminationSurge: false,
    mode: 'always',
    geofencing: 'off',
    useNewMotionAlgorithm: false,
    enablePirTimelapse: false
  },
  recordingSchedule: null,
  motionZones: [
    {
      name: 'Default',
      color: '#AB46BC',
      points: [Array],
      sensitivity: 65
    },
    {
      name: 'New Zone',
      color: '#586CED',
      points: [Array],
      sensitivity: 60
    },
    {
      name: 'New Zone',
      color: '#84D9FF',
      points: [Array],
      sensitivity: 70
    }
  ],
  privacyZones: [],
  stats: {
    rxBytes: 22965404648,
    txBytes: 844307531766,
    wifi: {
      channel: null,
      frequency: null,
      linkSpeedMbps: null,
      signalQuality: 50,
      signalStrength: 0
    },
    battery: { percentage: null, isCharging: false, sleepState: 'awake' },
    video: {
      recordingStart: 1580109334844,
      recordingEnd: 1581410053272,
      recordingStartLQ: 1580106624973,
      recordingEndLQ: 1581410053276,
      timelapseStart: 1579889345679,
      timelapseEnd: 1581409553265,
      timelapseStartLQ: 1579889345679,
      timelapseEndLQ: 1581409073289
    },
    wifiQuality: 50,
    wifiStrength: 0
  },
  featureFlags: {
    canAdjustIrLedLevel: false,
    canMagicZoom: true,
    canOpticalZoom: false,
    canTouchFocus: false,
    hasAccelerometer: false,
    hasAec: false,
    hasBattery: false,
    hasBluetooth: false,
    hasChime: false,
    hasExternalIr: true,
    hasIcrSensitivity: true,
    hasLdc: true,
    hasLedIr: true,
    hasLedStatus: false,
    hasLineIn: false,
    hasMic: true,
    hasPrivacyMask: true,
    hasRtc: false,
    hasSdCard: true,
    hasSpeaker: false,
    hasWifi: false,
    hasHdr: false,
    hasAutoICROnly: true,
    hasMotionZones: true
  },
  pirSettings: {
    pirSensitivity: 100,
    pirMotionClipLength: 15,
    timelapseFrameInterval: 15,
    timelapseTransferInterval: 600
  },
  wifiConnectionState: {
    channel: null,
    frequency: null,
    phyRate: null,
    signalQuality: null,
    signalStrength: null
  },
  id: '5e2b32aa02ec3e03e70003f0',
  isConnected: true,
  platform: 's2l',
  hasSpeaker: false,
  hasWifi: false,
  audioBitrate: 64000,
  modelKey: 'camera'
}[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] {
  isDeleting: false,
  mac: 'FCECDAD9BAAD',
  host: '192.168.1.32',
  connectionHost: '192.168.1.1',
  type: 'UVC G3',
  name: 'Entrata Posteriore',
  upSince: 1579110806692,
  lastSeen: 1581410038483,
  connectedSince: 1580844136366,
  state: 'CONNECTED',
  hardwareRevision: '22',
  firmwareVersion: '4.18.37',
  firmwareBuild: '3fcdcec.191223.613',
  isUpdating: false,
  isAdopting: false,
  isManaged: true,
  isProvisioned: true,
  isRebooting: false,
  isSshEnabled: false,
  canManage: false,
  isHidden: false,
  lastMotion: 1581409494033,
  micVolume: 100,
  isMicEnabled: true,
  isRecording: true,
  isMotionDetected: false,
  isAttemptingToConnect: false,
  phyRate: 100,
  hdrMode: false,
  isProbingForWifi: null,
  apMac: null,
  apRssi: null,
  elementInfo: null,
  chimeDuration: 300,
  isDark: false,
  motionStartCalls: 0,
  lastRing: null,
  wiredConnectionState: { phyRate: 100 },
  channels: [
    {
      id: 0,
      name: 'High',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1920,
      height: 1080,
      fps: 30,
      bitrate: 6000000,
      minBitrate: 750000,
      maxBitrate: 6000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 1,
      name: 'Medium',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1024,
      height: 576,
      fps: 15,
      bitrate: 1200000,
      minBitrate: 750000,
      maxBitrate: 2000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 2,
      name: 'Low',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 640,
      height: 360,
      fps: 15,
      bitrate: 200000,
      minBitrate: 32000,
      maxBitrate: 1000000,
      fpsValues: [Array],
      idrInterval: 5
    }
  ],
  ispSettings: {
    aeMode: 'auto',
    irLedMode: 'auto',
    irLedLevel: 255,
    wdr: 2,
    icrSensitivity: 0,
    brightness: 56,
    contrast: 47,
    hue: 50,
    saturation: 55,
    sharpness: 57,
    denoise: 57,
    isFlippedVertical: false,
    isFlippedHorizontal: false,
    isAutoRotateEnabled: false,
    isLdcEnabled: true,
    is3dnrEnabled: true,
    isExternalIrEnabled: false,
    isAggressiveAntiFlickerEnabled: false,
    isPauseMotionEnabled: false,
    dZoomCenterX: 50,
    dZoomCenterY: 50,
    dZoomScale: 0,
    dZoomStreamId: 4,
    focusMode: 'ztrig',
    focusPosition: 0,
    touchFocusX: 0,
    touchFocusY: 0,
    zoomPosition: 0
  },
  talkbackSettings: {
    typeFmt: 'aac',
    typeIn: 'serverudp',
    bindAddr: '0.0.0.0',
    bindPort: 7004,
    filterAddr: null,
    filterPort: null,
    channels: 1,
    samplingRate: 22050,
    bitsPerSample: 16,
    quality: 100
  },
  osdSettings: {
    isNameEnabled: false,
    isDateEnabled: true,
    isLogoEnabled: false,
    isDebugEnabled: false
  },
  ledSettings: { isEnabled: false, blinkRate: 0 },
  speakerSettings: { isEnabled: true, areSystemSoundsEnabled: false, volume: 80 },
  recordingSettings: {
    prePaddingSecs: 2,
    postPaddingSecs: 2,
    minMotionEventTrigger: 1000,
    endMotionEventDelay: 3000,
    suppressIlluminationSurge: false,
    mode: 'always',
    geofencing: 'off',
    useNewMotionAlgorithm: false,
    enablePirTimelapse: false
  },
  recordingSchedule: null,
  motionZones: [
    {
      name: 'Default',
      color: '#AB46BC',
      points: [Array],
      sensitivity: 70
    },
    {
      name: 'New Zone',
      color: '#586CED',
      points: [Array],
      sensitivity: 75
    }
  ],
  privacyZones: [],
  stats: {
    rxBytes: 23075312005,
    txBytes: 868790983310,
    wifi: {
      channel: null,
      frequency: null,
      linkSpeedMbps: null,
      signalQuality: 50,
      signalStrength: 0
    },
    battery: { percentage: null, isCharging: false, sleepState: 'awake' },
    video: {
      recordingStart: 1580111153022,
      recordingEnd: 1581410051102,
      recordingStartLQ: 1580106603200,
      recordingEndLQ: 1581410051139,
      timelapseStart: 1579889345615,
      timelapseEnd: 1581409751109,
      timelapseStartLQ: 1579889345615,
      timelapseEndLQ: 1581408876123
    },
    wifiQuality: 50,
    wifiStrength: 0
  },
  featureFlags: {
    canAdjustIrLedLevel: false,
    canMagicZoom: true,
    canOpticalZoom: false,
    canTouchFocus: false,
    hasAccelerometer: false,
    hasAec: false,
    hasBattery: false,
    hasBluetooth: false,
    hasChime: false,
    hasExternalIr: true,
    hasIcrSensitivity: true,
    hasLdc: true,
    hasLedIr: true,
    hasLedStatus: false,
    hasLineIn: false,
    hasMic: true,
    hasPrivacyMask: true,
    hasRtc: false,
    hasSdCard: true,
    hasSpeaker: false,
    hasWifi: false,
    hasHdr: false,
    hasAutoICROnly: true,
    hasMotionZones: true
  },
  pirSettings: {
    pirSensitivity: 100,
    pirMotionClipLength: 15,
    timelapseFrameInterval: 15,
    timelapseTransferInterval: 600
  },
  wifiConnectionState: {
    channel: null,
    frequency: null,
    phyRate: null,
    signalQuality: null,
    signalStrength: null
  },
  id: '5e2b32aa02803e03e70003ed',
  isConnected: true,
  platform: 's2l',
  hasSpeaker: false,
  hasWifi: false,
  audioBitrate: 64000,
  modelKey: 'camera'
}[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] {
  isDeleting: false,
  mac: 'FCECDAD9B952',
  host: '192.168.1.31',
  connectionHost: '192.168.1.1',
  type: 'UVC G3',
  name: 'Porta Rifiuti',
  upSince: 1579110806621,
  lastSeen: 1581410038464,
  connectedSince: 1580844136176,
  state: 'CONNECTED',
  hardwareRevision: '22',
  firmwareVersion: '4.18.37',
  firmwareBuild: '3fcdcec.191223.613',
  isUpdating: false,
  isAdopting: false,
  isManaged: true,
  isProvisioned: true,
  isRebooting: false,
  isSshEnabled: false,
  canManage: false,
  isHidden: false,
  lastMotion: 1581409485822,
  micVolume: 100,
  isMicEnabled: true,
  isRecording: true,
  isMotionDetected: false,
  isAttemptingToConnect: false,
  phyRate: 100,
  hdrMode: false,
  isProbingForWifi: null,
  apMac: null,
  apRssi: null,
  elementInfo: null,
  chimeDuration: 300,
  isDark: false,
  motionStartCalls: 0,
  lastRing: null,
  wiredConnectionState: { phyRate: 100 },
  channels: [
    {
      id: 0,
      name: 'High',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1920,
      height: 1080,
      fps: 30,
      bitrate: 6000000,
      minBitrate: 750000,
      maxBitrate: 6000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 1,
      name: 'Medium',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 1024,
      height: 576,
      fps: 15,
      bitrate: 1200000,
      minBitrate: 750000,
      maxBitrate: 2000000,
      fpsValues: [Array],
      idrInterval: 5
    },
    {
      id: 2,
      name: 'Low',
      enabled: true,
      isRtspEnabled: false,
      rtspAlias: null,
      width: 640,
      height: 360,
      fps: 15,
      bitrate: 200000,
      minBitrate: 32000,
      maxBitrate: 1000000,
      fpsValues: [Array],
      idrInterval: 5
    }
  ],
  ispSettings: {
    aeMode: 'auto',
    irLedMode: 'auto',
    irLedLevel: 255,
    wdr: 2,
    icrSensitivity: 0,
    brightness: 50,
    contrast: 50,
    hue: 50,
    saturation: 50,
    sharpness: 50,
    denoise: 50,
    isFlippedVertical: false,
    isFlippedHorizontal: false,
    isAutoRotateEnabled: false,
    isLdcEnabled: true,
    is3dnrEnabled: true,
    isExternalIrEnabled: false,
    isAggressiveAntiFlickerEnabled: false,
    isPauseMotionEnabled: false,
    dZoomCenterX: 50,
    dZoomCenterY: 50,
    dZoomScale: 0,
    dZoomStreamId: 4,
    focusMode: 'ztrig',
    focusPosition: 0,
    touchFocusX: 0,
    touchFocusY: 0,
    zoomPosition: 0
  },
  talkbackSettings: {
    typeFmt: 'aac',
    typeIn: 'serverudp',
    bindAddr: '0.0.0.0',
    bindPort: 7004,
    filterAddr: null,
    filterPort: null,
    channels: 1,
    samplingRate: 22050,
    bitsPerSample: 16,
    quality: 100
  },
  osdSettings: {
    isNameEnabled: false,
    isDateEnabled: true,
    isLogoEnabled: false,
    isDebugEnabled: false
  },
  ledSettings: { isEnabled: false, blinkRate: 0 },
  speakerSettings: { isEnabled: true, areSystemSoundsEnabled: false, volume: 80 },
  recordingSettings: {
    prePaddingSecs: 2,
    postPaddingSecs: 2,
    minMotionEventTrigger: 1000,
    endMotionEventDelay: 3000,
    suppressIlluminationSurge: false,
    mode: 'always',
    geofencing: 'off',
    useNewMotionAlgorithm: false,
    enablePirTimelapse: false
  },
  recordingSchedule: null,
  motionZones: [
    {
      name: 'Default',
      color: '#AB46BC',
      points: [Array],
      sensitivity: 85
    },
    {
      name: 'New Zone',
      color: '#586CED',
      points: [Array],
      sensitivity: 70
    },
    {
      name: 'New Zone',
      color: '#84D9FF',
      points: [Array],
      sensitivity: 85
    },
    {
      name: 'New Zone',
      color: '#19DDCC',
      points: [Array],
      sensitivity: 85
    }
  ],
  privacyZones: [],
  stats: {
    rxBytes: 22129881992,
    txBytes: 798101266716,
    wifi: {
      channel: null,
      frequency: null,
      linkSpeedMbps: null,
      signalQuality: 50,
      signalStrength: 0
    },
    battery: { percentage: null, isCharging: false, sleepState: 'awake' },
    video: {
      recordingStart: 1580110879719,
      recordingEnd: 1581410053204,
      recordingStartLQ: 1580106604907,
      recordingEndLQ: 1581410053207,
      timelapseStart: 1579889346959,
      timelapseEnd: 1581409543225,
      timelapseStartLQ: 1579889346959,
      timelapseEndLQ: 1581409168230
    },
    wifiQuality: 50,
    wifiStrength: 0
  },
  featureFlags: {
    canAdjustIrLedLevel: false,
    canMagicZoom: true,
    canOpticalZoom: false,
    canTouchFocus: false,
    hasAccelerometer: false,
    hasAec: false,
    hasBattery: false,
    hasBluetooth: false,
    hasChime: false,
    hasExternalIr: true,
    hasIcrSensitivity: true,
    hasLdc: true,
    hasLedIr: true,
    hasLedStatus: false,
    hasLineIn: false,
    hasMic: true,
    hasPrivacyMask: true,
    hasRtc: false,
    hasSdCard: true,
    hasSpeaker: false,
    hasWifi: false,
    hasHdr: false,
    hasAutoICROnly: true,
    hasMotionZones: true
  },
  pirSettings: {
    pirSensitivity: 100,
    pirMotionClipLength: 15,
    timelapseFrameInterval: 15,
    timelapseTransferInterval: 600
  },
  wifiConnectionState: {
    channel: null,
    frequency: null,
    phyRate: null,
    signalQuality: null,
    signalStrength: null
  },
  id: '5e2b32aa03113e03e70003f1',
  isConnected: true,
  platform: 's2l',
  hasSpeaker: false,
  hasWifi: false,
  audioBitrate: 64000,
  modelKey: 'camera'
}[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] Cameras: 1[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] Setup done[Homebridge] [2/11/2020, 09:34:16] [Unifi protect cameras & motion sensors] Motion checking setup done![Homebridge] [2/11/2020, 09:34:16] [Entrata Porta] is running on port 34545.[Homebridge] Motion events #: 0[Homebridge] Known accessories #: 1[Homebridge] Motion events #: 0[Homebridge] Known accessories #: 1[Homebridge] Motion events #: 0[Homebridge] Known accessories #: 1[Homebridge] Motion events #: 0[Homebridge] Known accessories #: 1[Homebridge] Motion events #: 0[Homebridge] Known accessories #: 1[Homebridge] Motion events #: 0
beele commented 4 years ago

@alezanott Thx! Seems to be fine so far. You have only added the Entrata Porta camera to the home app?

Can you post some logs when you actually try to trigger the motion sensor. It should show us some more info on how the motion event and the accessory are correlated.

alezanott commented 4 years ago

@alezanott Thx! Seems to be fine so far. You have only added the Entrata Porta camera to the home app?

Can you post some logs when you actually try to trigger the motion sensor. It should show us some more info on how the motion event and the accessory are correlated.

@beele Yes, exactly I've added only the Entrata Porta. I've also changed the motion_score to 30, to be sure that i get every kind of movement.

Here the logs when the motion sensor is triggered. Now it seems working, I get the notifications!

[Homebridge] [2/11/2020, 15:04:56] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e42b48600074d03e700de48) accepted for camera: Entrata Porta - Score: 36 !!!!
[Homebridge] Motion events #: 1
[Homebridge] Known accessories #: 1
[Homebridge] Motion event camera id: 5e2b32aa032d3e03e70003f2 - vs - Accessory camera id: 5e2b32aa032d3e03e70003f2
[Homebridge] [2/11/2020, 15:04:56] [Unifi protect cameras & motion sensors] !!!! Motion detected (36%) by camera Entrata Porta !!!!
[Homebridge] [2/11/2020, 15:04:56] [Unifi protect cameras & motion sensors] Snapshot from Entrata Porta at 480x270
[Homebridge] [2/11/2020, 15:04:56] [Unifi protect cameras & motion sensors] Snapshot from Entrata Porta at 480x270
[Homebridge] [2/11/2020, 15:05:01] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e42b48600074d03e700de48) accepted for camera: Entrata Porta - Score: 54 !!!!
[Homebridge] Motion events #: 1
[Homebridge] Known accessories #: 1
[Homebridge] Motion event camera id: 5e2b32aa032d3e03e70003f2 - vs - Accessory camera id: 5e2b32aa032d3e03e70003f2
[Homebridge] [2/11/2020, 15:05:01] [Unifi protect cameras & motion sensors] Motion detected inside of skippable timeframe, ignoring!
[Homebridge] [2/11/2020, 15:05:06] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e42b48600074d03e700de48) accepted for camera: Entrata Porta - Score: 54 !!!!
[Homebridge] [2/11/2020, 15:05:06] [Unifi protect cameras & motion sensors] Motion detected inside of skippable timeframe, ignoring!
[Homebridge] Motion events #: 1
[Homebridge] Known accessories #: 1
[Homebridge] Motion event camera id: 5e2b32aa032d3e03e70003f2 - vs - Accessory camera id: 5e2b32aa032d3e03e70003f2
[Homebridge] [2/11/2020, 15:05:11] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e42b48600074d03e700de48) accepted for camera: Entrata Porta - Score: 54 !!!!
[Homebridge] [2/11/2020, 15:05:11] [Unifi protect cameras & motion sensors] Motion detected inside of skippable timeframe, ignoring!
[Homebridge] Motion events #: 1
[Homebridge] Known accessories #: 1
[Homebridge] Motion event camera id: 5e2b32aa032d3e03e70003f2 - vs - Accessory camera id: 5e2b32aa032d3e03e70003f2
[Homebridge] [2/11/2020, 15:05:16] [Unifi protect cameras & motion sensors] !!!! Unifi Motion event (5e42b48600074d03e700de48) accepted for camera: Entrata Porta - Score: 54 !!!!
[Homebridge] [2/11/2020, 15:05:16] [Unifi protect cameras & motion sensors] Motion detected inside of skippable timeframe, ignoring!
[Homebridge] Motion events #: 1
[Homebridge] Known accessories #: 1
[Homebridge] Motion event camera id: 5e2b32aa032d3e03e70003f2 - vs - Accessory camera id: 5e2b32aa032d3e03e70003f2
[Homebridge] Motion events #: 0
[Homebridge] Known accessories #: 1

Thank you @beele for the amazing support given!!!

beele commented 4 years ago

Glad it's working now. No problem ;)

@nicgraner did you get it working already? Maybe try reinstalling/updating to the dev release as described above?

nicgraner commented 4 years ago

@beele Im working on it as we speak, just upgraded to your 0.1.0 version, so gonna get it going and will report back soon.

Edit: Im not sure whats going on, but at this point im not even getting any motion events anymore. I have the new version installed, and im not getting anywhere near as verbose of logs as @alezanott was getting, linked logs are below:


[Homebridge] [2/11/2020, 4:20:39 PM] Loaded config.json with 0 accessories and 3 platforms.
[Homebridge] [2/11/2020, 4:20:40 PM] Loaded plugin: "homebridge-camera-ffmpeg"
[Homebridge] [2/11/2020, 4:20:40 PM] Registering platform "homebridge-camera-ffmpeg.Camera-ffmpeg"
[Homebridge] [2/11/2020, 4:20:41 PM] Loaded plugin: "homebridge-unifi-protect-camera-motion"
[Homebridge] [2/11/2020, 4:20:41 PM] Registering platform "homebridge-unifi-protect-camera-motion.Unifi-Protect-Camera-Motion"
[Homebridge] [2/11/2020, 4:20:42 PM] Loaded plugin: "nest"
[Homebridge] [2/11/2020, 4:20:42 PM] Registering platform "nest.Nest"
[Homebridge] [2/11/2020, 4:20:42 PM] Loading 3 platforms...
[Homebridge] [2/11/2020, 4:20:42 PM] [Nest] Initializing Nest platform...
[Homebridge] [2/11/2020, 4:20:42 PM] [Nest] Fetching Nest devices.
[Homebridge] [2/11/2020, 4:20:42 PM] [Camera-ffmpeg] Initializing Camera-ffmpeg platform...
[Homebridge] [2/11/2020, 4:20:42 PM] [Unifi protect cameras & motion sensors] Initializing Unifi-Protect-Camera-Motion platform...
[Homebridge] [2/11/2020, 4:20:42 PM] Loading 0 accessories...
[Homebridge] [2/11/2020, 4:20:42 PM] [Unifi protect cameras & motion sensors] WARNING: No previous session found, a new session must be created!
[Homebridge] [2/11/2020, 4:20:42 PM] API launched
[Homebridge] [2/11/2020, 4:20:42 PM] [Unifi protect cameras & motion sensors] Authenticated, returning session
[Homebridge] [2/11/2020, 4:20:42 PM] [Unifi protect cameras & motion sensors] Cameras retrieved, enumerating motion sensors
[Homebridge] [2/11/2020, 4:20:42 PM] [Unifi protect cameras & motion sensors] Cameras: 5
[Homebridge] [2/11/2020, 4:20:42 PM] [Unifi protect cameras & motion sensors] Setup done
[Homebridge] [2/11/2020, 4:20:42 PM] [Living Room] is running on port 41405.
[Homebridge] [2/11/2020, 4:20:42 PM] [Office] is running on port 33711.
[Homebridge] [2/11/2020, 4:20:42 PM] [Stairs] is running on port 39431.
[Homebridge] [2/11/2020, 4:20:42 PM] [Bedroom] is running on port 43107.
[Homebridge] [2/11/2020, 4:20:42 PM] [Kitchen] is running on port 46387.
[Homebridge] [2/11/2020, 4:20:44 PM] [Unifi protect cameras & motion sensors] Motion checking setup done!
[Homebridge] [2/11/2020, 4:20:46 PM] [Nest] initing thermostat "Living Room": deviceId: 15AA01AC261706GT structureId: 40619660-d905-11e6-ac8a-22000bdd4933
[Homebridge] [2/11/2020, 4:20:46 PM] [Nest] initing home_away_sensor "Home/Away": deviceId: 40619660-d905-11e6-ac8a-22000bdd4933 structureId: 40619660-d905-11e6-ac8a-22000bdd4933
[Homebridge] [2/11/2020, 4:20:46 PM] [Nest] initing temp_sensor "Office": deviceId: 18B430CE02218176 structureId: 40619660-d905-11e6-ac8a-22000bdd4933
[Homebridge] [2/11/2020, 4:20:46 PM] [Nest] initing temp_sensor "Master Bedroom": deviceId: 18B430CF926A8B38 structureId: 40619660-d905-11e6-ac8a-22000bdd4933
[Homebridge] [2/11/2020, 4:20:46 PM] [Nest] Initializing platform accessory "Living Room".
[Homebridge] [2/11/2020, 4:20:46 PM] [Nest] Initializing platform accessory "Home/Away".
[Homebridge] [2/11/2020, 4:20:46 PM] [Nest] Initializing platform accessory "Office".
[Homebridge] [2/11/2020, 4:20:46 PM] [Nest] Initializing platform accessory "Master Bedroom".
[Homebridge] [2/11/2020, 4:20:46 PM] Service is running on port 51826.
[Homebridge] [2/11/2020, 4:21:01 PM] [Unifi protect cameras & motion sensors] Snapshot from Stairs at 480x270
[Homebridge] [2/11/2020, 4:21:01 PM] [Unifi protect cameras & motion sensors] Snapshot from Kitchen at 480x270
[Homebridge] [2/11/2020, 4:21:01 PM] [Unifi protect cameras & motion sensors] Snapshot from Office at 480x270
[Homebridge] [2/11/2020, 4:21:01 PM] [Unifi protect cameras & motion sensors] Snapshot from Living Room at 480x270
[Homebridge] [2/11/2020, 4:21:06 PM] [Unifi protect cameras & motion sensors] Start streaming video from Living Room with 640x360@132kBit
[Homebridge] [2/11/2020, 4:21:26 PM] [Unifi protect cameras & motion sensors] Snapshot from Kitchen at 480x270
[Homebridge] [2/11/2020, 4:21:26 PM] [Unifi protect cameras & motion sensors] Snapshot from Office at 480x270
[Homebridge] [2/11/2020, 4:21:26 PM] [Unifi protect cameras & motion sensors] Snapshot from Stairs at 480x270
[Homebridge] [2/11/2020, 4:21:27 PM] [Unifi protect cameras & motion sensors] Stopped streaming
[Homebridge] [2/11/2020, 4:21:30 PM] [Unifi protect cameras & motion sensors] Start streaming video from Office with 640x360@132kBit
[Homebridge] [2/11/2020, 4:21:43 PM] [Unifi protect cameras & motion sensors] Snapshot from Kitchen at 480x270
[Homebridge] [2/11/2020, 4:21:43 PM] [Unifi protect cameras & motion sensors] Snapshot from Living Room at 480x270
[Homebridge] [2/11/2020, 4:21:43 PM] [Unifi protect cameras & motion sensors] Snapshot from Stairs at 480x270
[Homebridge] [2/11/2020, 4:21:43 PM] [Unifi protect cameras & motion sensors] Stopped streaming
[Homebridge] [2/11/2020, 4:22:05 PM] Got SIGINT, shutting down service...
[Homebridge] [2/11/2020, 4:22:07 PM] Loaded config.json with 0 accessories and 3 platforms.
[Homebridge] [2/11/2020, 4:22:08 PM] Loaded plugin: "homebridge-camera-ffmpeg"
[Homebridge] [2/11/2020, 4:22:08 PM] Registering platform "homebridge-camera-ffmpeg.Camera-ffmpeg"
[Homebridge] [2/11/2020, 4:22:09 PM] Loaded plugin: "homebridge-unifi-protect-camera-motion"
[Homebridge] [2/11/2020, 4:22:09 PM] Registering platform "homebridge-unifi-protect-camera-motion.Unifi-Protect-Camera-Motion"
[Homebridge] [2/11/2020, 4:22:09 PM] Loaded plugin: "nest"
[Homebridge] [2/11/2020, 4:22:09 PM] Registering platform "nest.Nest"
[Homebridge] [2/11/2020, 4:22:09 PM] Loading 3 platforms...
[Homebridge] [2/11/2020, 4:22:09 PM] [Nest] Initializing Nest platform...
[Homebridge] [2/11/2020, 4:22:09 PM] [Nest] Fetching Nest devices.
[Homebridge] [2/11/2020, 4:22:09 PM] [Camera-ffmpeg] Initializing Camera-ffmpeg platform...
[Homebridge] [2/11/2020, 4:22:09 PM] [Unifi protect cameras & motion sensors] Initializing Unifi-Protect-Camera-Motion platform...
[Homebridge] [2/11/2020, 4:22:09 PM] Loading 0 accessories...
[Homebridge] [2/11/2020, 4:22:09 PM] [Unifi protect cameras & motion sensors] WARNING: No previous session found, a new session must be created!
[Homebridge] [2/11/2020, 4:22:09 PM] API launched
[Homebridge] [2/11/2020, 4:22:10 PM] [Unifi protect cameras & motion sensors] Authenticated, returning session
[Homebridge] [2/11/2020, 4:22:10 PM] [Unifi protect cameras & motion sensors] Cameras retrieved, enumerating motion sensors
[Homebridge] [2/11/2020, 4:22:10 PM] [Unifi protect cameras & motion sensors] Cameras: 5
[Homebridge] [2/11/2020, 4:22:10 PM] [Unifi protect cameras & motion sensors] Setup done
[Homebridge] [2/11/2020, 4:22:10 PM] [Living Room] is running on port 36363.
[Homebridge] [2/11/2020, 4:22:10 PM] [Office] is running on port 35919.
[Homebridge] [2/11/2020, 4:22:10 PM] [Stairs] is running on port 42367.
[Homebridge] [2/11/2020, 4:22:10 PM] [Bedroom] is running on port 42961.
[Homebridge] [2/11/2020, 4:22:10 PM] [Kitchen] is running on port 38033.
[Homebridge] [2/11/2020, 4:22:12 PM] [Unifi protect cameras & motion sensors] Motion checking setup done!
[Homebridge] [2/11/2020, 4:22:14 PM] [Nest] initing thermostat "Living Room": deviceId: 15AA01AC261706GT structureId: 40619660-d905-11e6-ac8a-22000bdd4933
[Homebridge] [2/11/2020, 4:22:14 PM] [Nest] initing home_away_sensor "Home/Away": deviceId: 40619660-d905-11e6-ac8a-22000bdd4933 structureId: 40619660-d905-11e6-ac8a-22000bdd4933
[Homebridge] [2/11/2020, 4:22:14 PM] [Nest] initing temp_sensor "Office": deviceId: 18B430CE02218176 structureId: 40619660-d905-11e6-ac8a-22000bdd4933
[Homebridge] [2/11/2020, 4:22:14 PM] [Nest] initing temp_sensor "Master Bedroom": deviceId: 18B430CF926A8B38 structureId: 40619660-d905-11e6-ac8a-22000bdd4933
[Homebridge] [2/11/2020, 4:22:14 PM] [Nest] Initializing platform accessory "Living Room".
[Homebridge] [2/11/2020, 4:22:14 PM] [Nest] Initializing platform accessory "Home/Away".
[Homebridge] [2/11/2020, 4:22:14 PM] [Nest] Initializing platform accessory "Office".
[Homebridge] [2/11/2020, 4:22:14 PM] [Nest] Initializing platform accessory "Master Bedroom".```

Edit: should probably mention the config of the plugin

```{
    "platform": "Unifi-Protect-Camera-Motion",
    "name": "Unifi protect cameras & motion sensors",
    "unifi": {
        "controller": "https://10.11.12.10:7443",
        "controller_rtsp": "rtsp://10.11.12.10:7447",
        "username": "homebridge",
        "password": "homebridge",
        "motion_interval": 5000,
        "motion_repeat_interval": 30000,
        "motion_score": 50,
        "enhanced_motion": true,
        "enhanced_motion_score": 50,
        "enhanced_classes": [
            "Person - or any other COCO classes, look in src/coco/classes.ts"
        ],
        "debug": false,
        "save_snapshot": true
    },
    "driveUpload": false,
    "videoConfig": {
        "vcodec": "h264_omx",
        "audio": true,
        "maxStreams": 2,
        "maxWidth": 1920,
        "maxHeight": 1080,
        "maxFPS": 30,
        "mapvideo": "0:1",
        "mapaudio": "0:0",
        "maxBitrate": 6000,
        "packetSize": 376,
        "additionalCommandline": "-protocol_whitelist https,crypto,srtp,rtp,udp"
    }
}```
nicgraner commented 4 years ago

Hate to come back to full circle, however my Pi was unable to keep up with the load of the 5 cameras, and so I have Homebridge running in a docker container on my home server, and im back to the error that I was having initially. Im uncertain on whether I should try to follow your guide or not (in regards to compiling ffmpeg) as its for raspberry pi's. I tried and it seemed to not work, so any help on what kind of ffmpeg install I would need would be amazing, as I was able to get notifications working, and it seems like this is the final hurdle I need to cross.


[2/11/2020, 9:30:47 PM] [Unifi protect cameras & motion sensors] Start streaming video from Stairs with 1280x720@299kBit
[2/11/2020, 9:30:49 PM] [Unifi protect cameras & motion sensors] ERROR: FFmpeg exited with code 1```
beele commented 4 years ago

@nicgraner Do the snapshots work? Is it only the streaming that fails? Maybe the ffmpeg is compiled without aac support. Could you try to disable audio in the plugin config? Another option (if audio is the problem) is to force the audio codec: "audio": true, "acodec": "libopus"

nicgraner commented 4 years ago

Snapshots do indeed work, ill try adding that audio codec force

Update: same result when adding "acodec": "libopus", to the config. same with disabling audio. I wish I could get better info other than just basic "failed with code 1" lol

If you would like to have faster conversation feel free to add me on discord: Nic#1337 as I would love to figure this out

beele commented 4 years ago

@nicgraner I don't have access to discord right now, maybe later.

You could try to add: "debug": true to the videoConfig that should output the ffmpeg debug logging. Note that this is not the same as the debug variable on the unifi config section!

nicgraner commented 4 years ago

So whats weird is after changing the codec back and forth a few times, I was able to get it to no longer error out, however it says in the ffmpeg log that it sent 232 frames in 8 seconds so roughly 30 fps which is what I have it set to, but the video stream itself on the iphone is refreshing as if its using the anonymous screenshots (I.e. every 8 seconds)


[rtp @ 0x55b8c4db6700] Sending NAL 1 of len 101 M=1

[libopus @ 0x55b8c4dd47a0] Trying to remove 216 more samples than there are in the queue

frame=  232 fps= 28 q=-1.0 Lsize=     154kB time=00:00:08.31 bitrate= 151.6kbits/s dup=4 drop=0 speed=0.991x    
video:147kB audio:22kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (rtsp://10.11.12.10:7447/Pi4A1aWTBGAzVswF):
  Input stream #0:0 (audio): 358 packets read (63996 bytes); 358 frames decoded (366592 samples); 
  Input stream #0:1 (video): 247 packets read (791924 bytes); 229 frames decoded; 
  Total: 605 packets (855920 bytes) demuxed
Output file #0 (srtp://10.11.12.180:63348?rtcpport=63348&localrtcpport=63348&pkt_size=376):
  Output stream #0:0 (video): 232 frames encoded; 232 packets muxed (150942 bytes); 

  Total: 232 packets (150942 bytes) muxed
Output file #1 (srtp://10.11.12.180:49704?rtcpport=49704&localrtcpport=49704&pkt_size=376):
  Output stream #1:0 (audio): 415 frames encoded (132800 samples); 416 packets muxed (22297 bytes); 

  Total: 416 packets (22297 bytes) muxed

587 frames successfully decoded, 0 decoding errors

[AVIOContext @ 0x55b8c4e6f540] Statistics: 0 seeks, 562 writeouts

[AVIOContext @ 0x55b8c4ea67e0] Statistics: 0 seeks, 418 writeouts

[libx264 @ 0x55b8c4db7ae0] frame I:1     Avg QP:33.59  size: 25112
[libx264 @ 0x55b8c4db7ae0] frame P:58    Avg QP:31.49  size:  1668
[libx264 @ 0x55b8c4db7ae0] frame B:173   Avg QP:41.57  size:   168
[libx264 @ 0x55b8c4db7ae0] consecutive B-frames:  0.4%  0.0%  1.3% 98.3%
[libx264 @ 0x55b8c4db7ae0] mb I  I16..4: 30.9% 61.8%  7.3%
[libx264 @ 0x55b8c4db7ae0] mb P  I16..4:  0.3%  0.3%  0.0%  P16..4:  3.8%  0.3%  0.8%  0.0%  0.0%    skip:94.4%
[libx264 @ 0x55b8c4db7ae0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  1.7%  0.0%  0.0%  direct: 0.0%  skip:98.3%  L0: 8.1% L1:91.9% BI: 0.0%
[libx264 @ 0x55b8c4db7ae0] 8x8 transform intra:58.8% inter:66.1%
[libx264 @ 0x55b8c4db7ae0] coded y,uvDC,uvAC intra: 17.2% 22.9% 0.8% inter: 0.3% 0.3% 0.0%
[libx264 @ 0x55b8c4db7ae0] i16 v,h,dc,p: 42% 33% 11% 15%
[libx264 @ 0x55b8c4db7ae0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 13% 45%  1%  3%  2%  2%  2%  2%
[libx264 @ 0x55b8c4db7ae0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 21% 14%  3%  4%  4%  5%  6%  3%
[libx264 @ 0x55b8c4db7ae0] i8c dc,h,v,p: 75% 12% 12%  0%
[libx264 @ 0x55b8c4db7ae0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x55b8c4db7ae0] ref P L0: 86.9%  8.5%  3.7%  0.9%
[libx264 @ 0x55b8c4db7ae0] ref B L0: 40.9% 58.5%  0.6%
[libx264 @ 0x55b8c4db7ae0] ref B L1: 86.2% 13.8%
[libx264 @ 0x55b8c4db7ae0] kb/s:156.15

Exiting normally, received signal 15.```
beele commented 4 years ago

@nicgraner strange, what happens if you let it stream for a bit longer (say 30 seconds or more)?

nicgraner commented 4 years ago

ill try it right now

edit; still seems to go one frame every 8 seconds like clockwork

This is repeated A LOT at the beginning of the stream before disappearing:


 Last message repeated 122 times
[h264 @ 0x56367aa82a00] nal_unit_type: 1, nal_ref_idc: 3

cur_dts is invalid (this is harmless if it occurs once at the start per stream)

[h264 @ 0x56367ac70980] nal_unit_type: 1, nal_ref_idc: 3

cur_dts is invalid (this is harmless if it occurs once at the start per stream)

[h264 @ 0x56367ac8c540] nal_unit_type: 1, nal_ref_idc: 3

cur_dts is invalid (this is harmless if it occurs once at the start per stream)```
beele commented 4 years ago

@nicgraner can you try swapping the codec to h264 instead of h264_omx since you are no longer running this on a raspberry pi.

Also what rstp stream resolution have you enabled for the cameras?

nicgraner commented 4 years ago

RTSP stream is set to high on the Unifi end, and in the config I have dropped it from 1920x1080 30fps 6k bitrate to 1280x720 20 fps 3k bitrate. I changed it to h264 and no change

beele commented 4 years ago

@nicgraner my cams are on the medium preset, maybe that does something. I read somewhere that issue might come from ffmpeg not being fast enough to deliver data to the iphone, but I would expect the stream to be cut off then and not keep doing itss thing. :/

nicgraner commented 4 years ago

Ill try dropping it a bit! I got a little ahead of myself thinking it would be fine since i was going from the power of a raspberry pi to my threadripper server lol :) ill follow up in a bit when I drop the settings.

beele commented 4 years ago

I suspect this is an issue with your version of ffmpeg. https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu not a fun & quick task but it might help.

nicgraner commented 4 years ago

I have no issues with it not being quick to setup as long as I can get it sorted in the end :) ill try compiling it right now

Changed settings:

RTSP in unifi: High > Medium max height and width in video_config: 1920x1080 > 1024x576 (to match the medium output in case resolution mismatch was causing issue)

other settings not changed but different from stock:

vcodec: h264 added acodec: libopus