Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UniFi Protect discussion #1538

Open
AlexxIT opened this issue Jan 5, 2025 · 22 comments
Open

UniFi Protect discussion #1538

AlexxIT opened this issue Jan 5, 2025 · 22 comments
Labels
camera Discussion on a particular camera model

Comments

@AlexxIT
Copy link
Owner

AlexxIT commented Jan 5, 2025

This issue is for discussing the operation of UniFi Protect software. Related links:

@AlexxIT AlexxIT added the camera Discussion on a particular camera model label Jan 5, 2025
@blockiindahood
Copy link

@AlexxIT regarding your comment on #1520 (comment)

Unifi does not accept my newly uploaded config, just throws an error.
See my code: https://gist.github.com/blockiindahood/89642419ca5947124deb16e2b1649a17

I did change the values as you described, do I have to edit anything else?

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 5, 2025

Are you sure your JSON valid (whole cameras.json file)?

@blockiindahood
Copy link

Yes, checked it.

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 5, 2025

Have you copied another ONVIF camera? Because I'm copied another go2rtc camera. I have added it via WebUI. Maybe other JSON values important. I don't know. I'll check it later.

@blockiindahood
Copy link

Yes, I've copied another ONVIF camera.

Could you share your config for one of your go2rtc cams?

@BrunoTCouto
Copy link
Contributor

#1520 (comment)

I got it right ?

Doing this way I don't need to have one instance of go2rtc for each camera ?

Or I only don't need to have one IP for each instance?

@BrunoTCouto
Copy link
Contributor

Wondering if I could connect directly to RTSP camera doing this way. Will test later

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 5, 2025

@blockiindahood this is my file https://gist.github.com/AlexxIT/d91b828171de3f2af2ca43b60d187c81
Just created it from the scratch. And tested. I'm using Protect 5.1.85.

@BrunoTCouto one go2rtc, one IP, unlimited cameras. This will work directly with any RTSP camera. Also without go2rtc.

@MartynasZilinskas
Copy link

@AlexxIT Thank you for sharing. From your configuration I only changed thirdPartyCameraInfo and it started working.

My best guess is channels misconfiguration on my side that stuck the streaming.

@blockiindahood
Copy link

@AlexxIT seems to be a zipping problem: downloading the config, unzipping it, not changing anything, zipping it, and uploading it, does not work.

only uploading an original downloaded zip file work for me

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 5, 2025

Maybe your archiver has a problem. I'm using the built in TotalCmd.

@blockiindahood
Copy link

I'll test this. I am using macOS's native one.

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 5, 2025

It works !! One go2rtc and two Hikvision facial detectors :D 🥇

image
Sem título

@BrunoTCouto
Copy link
Contributor

Hey @AlexxIT, I tried connecting directly, but Protect still need some api responses from ONVIF.

Anyways, thank you for the hack on protect. It will help a lot to manage just one go2rtsp instance :D 🎉

image
image

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 5, 2025

My config for reference:

go2rtc
streams:
  entrada_social: 'rtsp://user:[email protected]/Streaming/Channels/101/'
  entrada_servico: 'rtsp://user:[email protected]/Streaming/Channels/101/'
  porteiro_eletronico: 'rtsp://user:[email protected]/Streaming/Channels/101/'

rtsp:
  listen: ":9554"
  
log:
  api: trace
  onvif: trace  
protect
{
  "mac": "08BFB82D0680",
  "host": "192.168.1.96",
  "connectionHost": null,
  "type": " go2rtc",
  "name": " go2rtc",
  "upSince": null,
  "lastSeen": 1735606514489,
  "connectedSince": null,
  "lastDisconnect": 1735606515852,
  "authToken": null,
  "hardwareRevision": null,
  "firmwareVersion": null,
  "firmwareBuild": null,
  "isUpdating": false,
  "isAdopting": false,
  "isAdopted": true,
  "isAdoptedByOther": false,
  "isProvisioned": true,
  "isSshEnabled": false,
  "fingerprint": null,
  "password": "siMbOAuMSlyWy7zIfRWq",
  "guid": null,
  "anonymousDeviceId": null,
  "consoleId": null,
  "needForceAdopt": false,
  "lastMotion": null,
  "micVolume": 80,
  "isMicEnabled": true,
  "hdrMode": false,
  "videoMode": "default",
  "isProbingForWifi": false,
  "apMac": null,
  "apRssi": null,
  "elementInfo": null,
  "chimeDuration": 0,
  "lastRing": null,
  "activePatrolSlot": null,
  "useGlobal": false,
  "downScaleMode": 0,
  "isExtenderInstalledEver": false,
  "userConfiguredAp": false,
  "videoCodec": "h264",
  "videoCodecState": 0,
  "isThirdPartyCamera": true,
  "isPairedWithAiPort": false,
  "ptzControlEnabled": false,
  "channels": [
    {
      "id": 0,
      "videoId": "video1",
      "name": "High",
      "enabled": true,
      "isRtspEnabled": false,
      "rtspAlias": null,
      "width": 1920,
      "height": 1080,
      "fps": null,
      "bitrate": null,
      "minBitrate": null,
      "maxBitrate": null,
      "minClientAdaptiveBitRate": null,
      "minMotionAdaptiveBitRate": null,
      "fpsValues": [
        null
      ],
      "idrInterval": 5,
      "autoFps": false,
      "autoBitrate": false
    },
    {
      "id": 1,
      "videoId": "video2",
      "name": "Medium",
      "enabled": true,
      "isRtspEnabled": false,
      "rtspAlias": null,
      "width": 1920,
      "height": 1080,
      "fps": null,
      "bitrate": null,
      "minBitrate": null,
      "maxBitrate": null,
      "minClientAdaptiveBitRate": null,
      "minMotionAdaptiveBitRate": null,
      "fpsValues": [
        null
      ],
      "idrInterval": 5,
      "autoFps": false,
      "autoBitrate": false
    },
    {
      "id": 2,
      "videoId": "video3",
      "name": "Low",
      "enabled": true,
      "isRtspEnabled": false,
      "rtspAlias": null,
      "width": 1920,
      "height": 1080,
      "fps": null,
      "bitrate": null,
      "minBitrate": null,
      "maxBitrate": null,
      "minClientAdaptiveBitRate": null,
      "minMotionAdaptiveBitRate": null,
      "fpsValues": [
        null
      ],
      "idrInterval": 5,
      "autoFps": false,
      "autoBitrate": false
    }
  ],
  "ispSettings": {
    "aeMode": "auto",
    "irLedMode": "auto",
    "irLedLevel": 255,
    "wdr": 1,
    "icrSensitivity": 0,
    "icrSwitchMode": "sensitivity",
    "icrCustomValue": 2,
    "brightness": 50,
    "contrast": 50,
    "hue": 50,
    "saturation": 50,
    "sharpness": 50,
    "denoise": 50,
    "isColorNightVisionEnabled": false,
    "spotlightDuration": 15,
    "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,
    "mountPosition": null,
    "hdrMode": "normal",
    "sceneMode": "auto"
  },
  "audioSettings": {
    "style": [
      "nature"
    ]
  },
  "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": false,
    "isLogoEnabled": true,
    "isDebugEnabled": false
  },
  "ledSettings": {
    "isEnabled": true,
    "blinkRate": 0
  },
  "speakerSettings": {
    "isEnabled": true,
    "areSystemSoundsEnabled": false,
    "volume": 80,
    "ringVolume": 80
  },
  "recordingSettings": {
    "prePaddingSecs": 2,
    "postPaddingSecs": 2,
    "smartDetectPrePaddingSecs": 2,
    "smartDetectPostPaddingSecs": 2,
    "minMotionEventTrigger": 1000,
    "endMotionEventDelay": 3000,
    "suppressIlluminationSurge": false,
    "_recordingEventOnly": "detections",
    "mode": "always",
    "_inScheduleMode": "always",
    "inScheduleMode": "always",
    "_outScheduleMode": "never",
    "outScheduleMode": "never",
    "geofencing": "off",
    "motionAlgorithm": "stable",
    "enableMotionDetection": true
  },
  "smartDetectSettings": {
    "objectTypes": [],
    "autoTrackingObjectTypes": [],
    "autoTrackingWithZoom": true,
    "audioTypes": [],
    "detectionRange": {
      "max": null,
      "min": null
    }
  },
  "recordingSchedulesV2": [],
  "motionZones": [],
  "privacyZones": [],
  "smartDetectZones": [],
  "smartDetectLines": [],
  "smartDetectLoiterZones": [],
  "stats": {
    "rxBytes": 0,
    "txBytes": 0,
    "wifi": {
      "channel": null,
      "frequency": null,
      "linkSpeedMbps": null,
      "signalQuality": 50,
      "signalStrength": 0
    },
    "video": {
      "recordingStart": 1735601874840,
      "recordingEnd": 1735606474800,
      "recordingStartLQ": 1735603883520,
      "recordingEndLQ": 1735606500800,
      "timelapseStart": 1735603883520,
      "timelapseEnd": 1735606003720,
      "timelapseStartLQ": 1735603883520,
      "timelapseEndLQ": 1735604783560
    },
    "lenses": []
  },
  "featureFlags": {
    "canAdjustIrLedLevel": false,
    "canMagicZoom": false,
    "canOpticalZoom": false,
    "canTouchFocus": false,
    "hasAccelerometer": false,
    "hasVerticalFlip": true,
    "hasAec": false,
    "hasBluetooth": false,
    "hasChime": false,
    "hasExternalIr": false,
    "hasIcrSensitivity": true,
    "hasInfrared": false,
    "hasLdc": false,
    "hasLedIr": false,
    "hasLedStatus": false,
    "hasLineIn": false,
    "hasMic": false,
    "hasPrivacyMask": true,
    "hasRtc": false,
    "hasSdCard": false,
    "hasSpeaker": false,
    "hasWifi": false,
    "hasHdr": false,
    "hasAutoICROnly": false,
    "videoModes": [],
    "videoModeMaxFps": [],
    "hasMotionZones": true,
    "hasLcdScreen": false,
    "hasFingerprintSensor": false,
    "mountPositions": [],
    "videoSourceCount": 1,
    "smartDetectTypes": [],
    "smartDetectAudioTypes": [],
    "supportDoorAccessConfig": false,
    "supportNfc": false,
    "supportLpDetectionWithoutVehicle": false,
    "lensType": null,
    "lensModel": null,
    "motionAlgorithms": [],
    "hasSquareEventThumbnail": false,
    "hasPackageCamera": false,
    "audio": [],
    "audioCodecs": [],
    "videoCodecs": [],
    "audioStyle": [],
    "isDoorbell": false,
    "isPtz": false,
    "hasColorLcdScreen": false,
    "hasLiveviewTracking": false,
    "hasLineCrossing": false,
    "hasLineCrossingCounting": false,
    "hasFlash": false,
    "flashRange": null,
    "hasLuxCheck": false,
    "presetTour": false,
    "hasEdgeRecording": false,
    "hasLprReflex": false,
    "privacyMaskCapability": {
      "maxMasks": null,
      "rectangleOnly": false
    },
    "focus": {
      "steps": {
        "max": null,
        "min": null,
        "step": null
      },
      "degrees": {
        "max": null,
        "min": null,
        "step": null
      }
    },
    "pan": {
      "steps": {
        "max": null,
        "min": null,
        "step": null
      },
      "degrees": {
        "max": null,
        "min": null,
        "step": null
      }
    },
    "tilt": {
      "steps": {
        "max": null,
        "min": null,
        "step": null
      },
      "degrees": {
        "max": null,
        "min": null,
        "step": null
      }
    },
    "zoom": {
      "ratio": 22,
      "steps": {
        "max": null,
        "min": null,
        "step": null
      },
      "degrees": {
        "max": null,
        "min": null,
        "step": null
      }
    },
    "hotplug": {
      "audio": null,
      "video": null,
      "standaloneAdoption": false,
      "extender": {
        "isAttached": null,
        "hasFlash": null,
        "flashRange": null,
        "hasIR": null,
        "hasRadar": null,
        "radarRangeMax": null,
        "radarRangeMin": null
      }
    }
  },
  "lcdMessage": {},
  "streamSharing": {
    "enabled": false,
    "token": null,
    "shareLink": null,
    "expires": null,
    "sharedByUserId": null,
    "sharedByUser": null,
    "maxStreams": null
  },
  "homekitSettings": {
    "talkbackSettingsActive": false,
    "streamInProgress": false,
    "microphoneMuted": false,
    "speakerMuted": false
  },
  "shortcuts": [],
  "thirdPartyCameraInfo": {
    "port": "1984",
    "username": "admin",
    "password": "admin",
    "rtspUrl": "rtsp://192.168.1.96:9554/entrada_social",
    "rtspUrlLQ": "rtsp://192.168.1.96:9554/entrada_social",
    "snapshotUrl": "http://192.168.1.96:1984/api/frame.jpeg?src=entrada_social"
  },
  "fingerprintSettings": {
    "enable": false,
    "enablePrintLatency": false,
    "mode": "identify",
    "reportFingerTouch": false,
    "reportCaptureComplete": false
  },
  "nfcSettings": {
    "enableNfc": false,
    "supportThirdPartyCard": false
  },
  "id": "6773359103e08303e4000500"
}

On protect configuration, I changed

  • mac
  • id
  • thirdPartyCameraInfo

You will also need to change the host as yours will be different from mine

@BrunoTCouto
Copy link
Contributor

RateControl fix

#1539

@michael-blue2
Copy link

I have been trying for some hours to get this done, but no luck. I can get the go2rtc camera to show up in unify but its just offline. Just something that I though:
I am running go2rtc inside ha, which that makes my ip to be 127.0.0.1 correct?
Some trouble shooting:
I can connect though generic camera with: rtsp://127.0.0.1:9554/doorbell with ha
but if i try to connect using onvif then I cannot.

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 7, 2025

  • I have problems with stream with AAC audio. Haven't figured it out yet, but if audio is turned off, the stream works
  • 127.0.0.1 - it's localhost. Shouldn't work
  • Protect doesn't support ONVIF from any go2rtc releases. Only latest master version supported

@michael-blue2
Copy link

  1. How do you disable the audio? I haven't found anything online its a KD8003 Doorbell
  2. any idea how to find my IP on go2rtc installed in HA? sometimes on the log it does shows a 192.168.0.17 which I assume it should be.
  3. When should be expect the update with the implemented support?

@blockiindahood
Copy link

blockiindahood commented Jan 7, 2025

@michael-blue2 the IP of go2rtc is the local ip of your HA instance together with port 1984
for me its: https://10.1.50.185:1984/

@michael-blue2
Copy link

@blockiindahood thank you for that, now everything does click! ahahah

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 7, 2025

Hey @AlexxIT I am not sure if this is another thing that broke after the onvif refactor, but now I only can use the auto stream, before I was able to select low, auto and high on Protect

About audio, looks like the protect onvif integration does not work with audio at all. Even direct camera access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
camera Discussion on a particular camera model
Projects
None yet
Development

No branches or pull requests

5 participants