QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
354 stars 49 forks source link

Set PIR fails with `Service Unavailable` for Argus Eco #51

Closed fmarzocca closed 1 year ago

fmarzocca commented 1 year ago

My camera is an Argus Eco. I am trying to switch OFF the PIR:

./neolink pir --config=neolink_config.toml giardino off
[2023-03-31T07:56:20Z INFO  neolink] Neolink 4fcaf4d538dc6e05434690bdf7f3a3bc22b077e3 release
[2023-03-31T07:56:20Z INFO  neolink::utils] giardino: Connecting to camera at UID: 95270004YFGE16SE
[2023-03-31T07:56:22Z INFO  neolink_core::bc_protocol] Relay success 95270004YFGE16SE at 35.180.129.86:51736
[2023-03-31T07:56:22Z INFO  neolink::utils] giardino: Logging in
[2023-03-31T07:56:24Z INFO  neolink::utils] giardino: Connected and logged in
Error: Unable to set camera PIR state

Caused by:
    Camera responded with Service Unavaliable
QuantumEntangledAndy commented 1 year ago

Maybe this has something to do with the battery camera waking up? The camera usually sends a bunch of messages such as the capabilities after login so maybe I should wait for some of those

QuantumEntangledAndy commented 1 year ago

I notice that 212 fails if it sends before these capability messages

fmarzocca commented 1 year ago

I think you are right

fmarzocca commented 1 year ago

Maybe you should wait for the capability messages before sending the command.

QuantumEntangledAndy commented 1 year ago

I'm working on creating something to properly parse tha capability. Since we can use it to give useful error messages such as this camera dosent support pir

fmarzocca commented 1 year ago

Ok. Thank you. Just let me know if you need more tests.

fmarzocca commented 1 year ago

After many tests, I can confirm this: your neolink is correctly working only if I keep the connection alive (either through Client on computer or App on smartphone).

QuantumEntangledAndy commented 1 year ago

Ok next test build will be here: https://github.com/QuantumEntangledAndy/neolink/actions/runs/4606409632

QuantumEntangledAndy commented 1 year ago

It waits for ability information and checks that we have rfAlarm_rw premissions.

fmarzocca commented 1 year ago

the build failed

QuantumEntangledAndy commented 1 year ago

Ah sorry forgot to commit the new file and not just the modified ones.

QuantumEntangledAndy commented 1 year ago

Ok on its way https://github.com/QuantumEntangledAndy/neolink/actions/runs/4607363019

fmarzocca commented 1 year ago

It works! Great job!

QuantumEntangledAndy commented 1 year ago

Are we all good? If so I'll close this and merge

fmarzocca commented 1 year ago

Randomly, it happens that upon a request the connections fails and it responds with:

Error: Unable to get camera PIR state
Caused by:
    Camera responded with Service Unavaliable
fmarzocca commented 1 year ago

I need to send the command twice in order to get it working everytime. It seems that first command needs to set the camera alive (failing) and the second goes through. Sometime one command is enough, but mostly not.

QuantumEntangledAndy commented 1 year ago

Ok then, since the error code is always 400. I will see about retrying the messages if we get that error code.

QuantumEntangledAndy commented 1 year ago

Ok retry build is here https://github.com/QuantumEntangledAndy/neolink/actions/runs/4615033288

QuantumEntangledAndy commented 1 year ago

Reties every 0.5s for 2.5s

fmarzocca commented 1 year ago

Perfect! This is very good, no failures. Yes, you can merge this. I will keep using this build.

QuantumEntangledAndy commented 1 year ago

Merged in #53