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

Doorbell setup #48

Closed crxporter closed 3 years ago

crxporter commented 4 years ago

@beele - I'm not personally using your plugin but for the good of the community and all I thought it would be nice to open an issue about the doorbell and share a little about what I'm doing. I'll watch the topic, feel free to ask what I've done.

I've got mine set up now with video, 1-way audio, motion, and doorbell button presses. The first 3 of those should work out of the box with your existing plugin. I'm running button presses very similar to how I'm running motion alerts. The JSON key lastMotion timestamp is used for motion, the JSON key LastRing has the same format but will show the last time the button was pressed. I have a linked service programmable switch to the camera service to send the doorbell button press. Rich button notifications work great, here's the live view notification after a fedex drop off yesterday:

IMG_5747

I'm looking over the JSON trying to see what else might be useful - type: "UVC G4 Doorbell". Also the aspect ration is 4:3, my G3 flex cameras are 16:9. Still no 2-way audio success yet, I'm still working on that with the developer for @nrchkb - I'll update #39 if we get that going.

Full JSON (partly redacted):

{
  "isDeleting": false,
  "mac": "*****",
  "host": "*****",
  "connectionHost": "*****",
  "type": "UVC G4 Doorbell",
  "name": "UVC G4 Doorbell",
  "upSince": 1590241611080,
  "lastSeen": 1590783905442,
  "connectedSince": 1590241638032,
  "state": "CONNECTED",
  "hardwareRevision": "20",
  "firmwareVersion": "4.23.7",
  "firmwareBuild": "ae5c6d8.200507.1038",
  "isUpdating": false,
  "isAdopting": false,
  "isManaged": true,
  "isProvisioned": true,
  "isRebooting": false,
  "isSshEnabled": false,
  "canManage": false,
  "isAttemptingToConnect": false,
  "isHidden": false,
  "lastMotion": 1590783863818,
  "micVolume": 100,
  "isMicEnabled": true,
  "isRecording": true,
  "isMotionDetected": false,
  "phyRate": 200,
  "hdrMode": true,
  "isProbingForWifi": false,
  "apMac": "*****",
  "apRssi": 60,
  "elementInfo": "Hello",
  "chimeDuration": 300,
  "isDark": false,
  "lastRing": 1590701536006,
  "wiredConnectionState": {
    "phyRate": null
  },
  "channels": [
    {
      "id": 0,
      "videoId": "video1",
      "name": "High",
      "enabled": true,
      "isRtspEnabled": true,
      "rtspAlias": "*****",
      "width": 1600,
      "height": 1200,
      "fps": 30,
      "bitrate": 6000000,
      "minBitrate": 750000,
      "maxBitrate": 6000000,
      "minClientAdaptiveBitRate": 0,
      "minMotionAdaptiveBitRate": 750000,
      "fpsValues": [
        1,
        2,
        3,
        4,
        5,
        6,
        8,
        9,
        10,
        12,
        15,
        16,
        18,
        20,
        24,
        25,
        30
      ],
      "idrInterval": 5
    },
    {
      "id": 1,
      "videoId": "video3",
      "name": "Medium",
      "enabled": true,
      "isRtspEnabled": true,
      "rtspAlias": "*****",
      "width": 960,
      "height": 720,
      "fps": 15,
      "bitrate": 1200000,
      "minBitrate": 750000,
      "maxBitrate": 2000000,
      "minClientAdaptiveBitRate": 150000,
      "minMotionAdaptiveBitRate": 750000,
      "fpsValues": [
        1,
        2,
        3,
        4,
        5,
        6,
        8,
        9,
        10,
        12,
        15,
        16,
        18,
        20,
        24,
        25,
        30
      ],
      "idrInterval": 5
    },
    {
      "id": 2,
      "videoId": "video2",
      "name": "Low",
      "enabled": true,
      "isRtspEnabled": false,
      "rtspAlias": null,
      "width": 480,
      "height": 360,
      "fps": 15,
      "bitrate": 200000,
      "minBitrate": 32000,
      "maxBitrate": 1000000,
      "minClientAdaptiveBitRate": 0,
      "minMotionAdaptiveBitRate": 0,
      "fpsValues": [
        1,
        2,
        3,
        4,
        5,
        6,
        8,
        9,
        10,
        12,
        15,
        16,
        18,
        20,
        24,
        25,
        30
      ],
      "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": 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": "",
    "filterPort": 0,
    "channels": 1,
    "samplingRate": 22050,
    "bitsPerSample": 16,
    "quality": 100
  },
  "osdSettings": {
    "isNameEnabled": false,
    "isDateEnabled": false,
    "isLogoEnabled": false,
    "isDebugEnabled": false
  },
  "ledSettings": {
    "isEnabled": true,
    "blinkRate": 0
  },
  "speakerSettings": {
    "isEnabled": false,
    "areSystemSoundsEnabled": false,
    "volume": 80
  },
  "recordingSettings": {
    "prePaddingSecs": 3,
    "postPaddingSecs": 3,
    "minMotionEventTrigger": 1000,
    "endMotionEventDelay": 3000,
    "suppressIlluminationSurge": false,
    "mode": "always",
    "geofencing": "off",
    "useNewMotionAlgorithm": true,
    "enablePirTimelapse": false
  },
  "recordingSchedule": null,
  "motionZones": [
    {
      "name": "Default",
      "color": "#AB46BC",
      "points": [
        [
          0,
          0.4265402843601896
        ],
        [
          0.09577779134114583,
          0.5781990702118354
        ],
        [
          0.37144441731770833,
          0.5570094786729857
        ],
        [
          0.6984444173177083,
          0.6138057595203272
        ],
        [
          0.6996666666666667,
          0.20260663507109006
        ],
        [
          1,
          0
        ],
        [
          1,
          1
        ],
        [
          0,
          1
        ]
      ],
      "sensitivity": 75
    }
  ],
  "privacyZones": [],
  "stats": {
    "rxBytes": 3849943834,
    "txBytes": 152165032072,
    "wifi": {
      "channel": 44,
      "frequency": 5220,
      "linkSpeedMbps": null,
      "signalQuality": 100,
      "signalStrength": -58
    },
    "battery": {
      "percentage": null,
      "isCharging": false,
      "sleepState": "awake"
    },
    "video": {
      "recordingStart": 1590102789906,
      "recordingEnd": 1590783934679,
      "recordingStartLQ": 1590102794930,
      "recordingEndLQ": 1590783934719,
      "timelapseStart": 1590102789919,
      "timelapseEnd": 1590783479690,
      "timelapseStartLQ": 1590102789919,
      "timelapseEndLQ": 1590782419641
    },
    "wifiQuality": 100,
    "wifiStrength": -58
  },
  "featureFlags": {
    "canAdjustIrLedLevel": false,
    "canMagicZoom": false,
    "canOpticalZoom": false,
    "canTouchFocus": false,
    "hasAccelerometer": false,
    "hasAec": true,
    "hasBattery": false,
    "hasBluetooth": true,
    "hasChime": true,
    "hasExternalIr": false,
    "hasIcrSensitivity": true,
    "hasLdc": true,
    "hasLedIr": true,
    "hasLedStatus": true,
    "hasLineIn": false,
    "hasMic": true,
    "hasPrivacyMask": true,
    "hasRtc": false,
    "hasSdCard": false,
    "hasSpeaker": true,
    "hasWifi": true,
    "hasHdr": true,
    "hasAutoICROnly": true,
    "hasMotionZones": true,
    "hasLcdScreen": true
  },
  "pirSettings": {
    "pirSensitivity": 100,
    "pirMotionClipLength": 15,
    "timelapseFrameInterval": 15,
    "timelapseTransferInterval": 600
  },
  "lcdMessage": {},
  "wifiConnectionState": {
    "channel": 44,
    "frequency": 5220,
    "phyRate": 200,
    "signalQuality": 100,
    "signalStrength": -58
  },
  "id": "5ec6fd10020d470387000407",
  "isConnected": true,
  "platform": "s5l",
  "hasSpeaker": true,
  "hasWifi": true,
  "audioBitrate": 64000,
  "modelKey": "camera"
}
beele commented 4 years ago

Thx for the info, I'll be looking to add this in the future!

beele commented 4 years ago

Doorbell support is in the works (without two way audio).

durosity commented 4 years ago

Doorbell support is in the works (without two way audio).

Do ya think two-way audio is something that will come? My holy grail would be a unifi doorbell* with Homebridge supporting 2-way audio.. and if I’m being greedy HKSV!

*preferably if they made a POE doorbell. Oooh the thought of all that sounds like doorbell nirvana!

crxporter commented 4 years ago

Do ya think two-way audio is something that will come?

The issue with 2-way audio is that nobody but unifi knows how to send audio to the camera. I spent a couple of days trying to make it happen with no success.

I believe there’s a token for authentication which is sent from the nvr (dream machine pro for me) to the camera. I plan to give it another try sometime - if anyone has suggestions for making it work, please share!

BadgerBadgerAndFox commented 4 years ago

@beele fantastic news, doorbell support will be great with the upcoming integrations announced for homekit in tvOS 14 for apple tv!

beele commented 4 years ago

The beta version does already expose the doorbell functionality (like the base homebridge-camera-ffmpeg does) So an extra trigger button which will trigger a "someone rung the bell" event in homekit

mikestecker commented 4 years ago

Just received and installed mine today... watching.

beele commented 4 years ago

The latest beta: homebridge-unifi-protect-camera-motion@0.4.1-Beta.5 has support for the doorbell logic and manual triggers Add: "enable_doorbell": true to the config to enable it

beele commented 4 years ago

no two way audio though

beele commented 3 years ago

Implemented as per release 0.4.1