keshavdv / unifi-cam-proxy

Enable non-Ubiquiti cameras to work with Unifi NVR
MIT License
1.73k stars 237 forks source link

Can't create an adoption token in Unifi Protect #328

Closed tpmullan closed 1 year ago

tpmullan commented 1 year ago

Camera

any

Firmware version of the camera

any

Description

There is no longer a way to generate a token in the Unifi Protect interface. I tried manually navigating to the URL in the documentation but that did not work either. Would it be possible to implement the adoption process instead? After trying to connect the script does generate a camera, but when I tell unifi to adopt it, the script continues to crash.

How to reproduce

Navigate to https://{NVR IP}/protect/devices/add and be redirected to https://{NVR IP}/protect/devices

Expected behaviour

Be allowed to add the camera

Screenshots

n/a

Aditional information

n/a

tpmullan commented 1 year ago

Longs from the Protect server seem to indicate if we implement the api on the cameras it could work.

{
  message: 'Request failed : http://<docker-container-ip>/api/1.1/login. Camera responded with a status code of 404',
  stack: 'Error: Request failed : http://1<docker-container-ip>/api/1.1/login. Camera responded with a status code of 404\n' +
    '    at Request._callback (/usr/share/unifi-protect/app/webpack:/unifi-protect/src/middleware/cameras/api/request.js:114:21)\n' +
    '    at Request.self.callback (/usr/share/unifi-protect/app/node_modules/request/request.js:185:22)\n' +
    '    at Request.emit (node:events:513:28)\n' +
    '    at Request.emit (node:domain:489:12)\n' +
    '    at Request.<anonymous> (/usr/share/unifi-protect/app/node_modules/request/request.js:1154:10)\n' +
    '    at Request.emit (node:events:513:28)\n' +
    '    at Request.emit (node:domain:489:12)\n' +
    '    at IncomingMessage.<anonymous> (/usr/share/unifi-protect/app/node_modules/request/request.js:1076:12)\n' +
    '    at Object.onceWrapper (node:events:627:28)\n' +
    '    at IncomingMessage.emit (node:events:525:35)\n' +
    '    at IncomingMessage.emit (node:domain:489:12)\n' +
    '    at endReadableNT (node:internal/streams/readable:1358:12)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:83:21)',
  statusCode: 404,
  path: 'api/1.1/snapshot',
  method: 'POST'
}
tpmullan commented 1 year ago

It looks like the documents just need to be update.

https://{NVR ip}/proxy/protect/api/cameras/manage-payload

worked for me