keshavdv / unifi-cam-proxy

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

Reolink motion events no longer being processed #280

Closed bigjools closed 1 year ago

bigjools commented 1 year ago

Camera

Reolink 822A

Firmware version of the camera

v3.1.0.989_22081907

Description

It looks like the basic events API no longer accepts user and password parameters on the POST URL; instead you have to retrieve a token and use that. See https://drive.google.com/file/d/15AFMQSMlMdpjL2USPsvYd-J9xWecrEf9/view for the latest API. I am not sure at which firmware version this happened but at least the most recent one I installed as written above has broken things.

The upshot is that motion events are never received and/or sent to Protect since the way the current request is done always results in an error from the camera saying that you need to log in.

If I change the URL to a GET and remove the body of the request, it defaults to channel 0 anyway and you get back the expected response. However - I tried a quick hack to do this and it didn't pick up the motion, so something else is wrong.

How to reproduce

Using any web request client (I'm using HTTPie here), you can see the response:

$ http -v --json 'http://<redacted>/api.cgi?cmd=GetMdState&user=<redacted>&password=<redacted?' cmd=GetMdState 'param:={"channel": 0}'
POST /api.cgi?cmd=GetMdState&user=admin&password=pop-tart HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 46
Content-Type: application/json
Host: 192.168.4.124
User-Agent: HTTPie/2.6.0

{
    "cmd": "GetMdState",
    "param": {
        "channel": 0
    }
}

HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: text/html
Date: Mon, 20 Feb 2023 05:41:43 GMT
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

[
    {
        "cmd": "GetMdState",
        "code": 1,
        "error": {
            "detail": "please login first",
            "rspCode": -6
        }
    }
]

Expected behaviour

No response

Screenshots

No response

Aditional information

No response

bigjools commented 1 year ago

Having said all that, I cannot get the login to work either! Requesting a token via the login API returns "please login first". Huh.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

bigjools commented 1 year ago

Nobody else seeing this?