QuantumEntangledAndy / neolink

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

status-light doesn't accept value #172

Closed EliteGurke closed 5 months ago

EliteGurke commented 11 months ago

Describe the bug Trying to turn status-light on or off fails with error message.

To Reproduce Test 1: neolink status-light --config=/usr/local/etc/neolink.toml cam1 off gives following error: error: 0 values required for '[on|off]' but 1 was provided

Test 2: neolink status-light --config=/usr/local/etc/neolink.toml cam1 goes through and deactivates the status-light. Sadly there's no way to turn it on again.

Expected behavior status-led should turn on or off, depending the option

Versions Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release Model Reolink Argus Eco Firmware Version 0223_740_747_413

Full Output $ neolink status-light --config=/usr/local/etc/neolink.toml cam1 of [2023-10-18T19:32:31Z INFO neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release error: 0 values required for '[on|off]' but 1 was provided

Usage: neolink status-light [OPTIONS] [on|off]

For more information, try '--help'.

Possible bug in statusled/cmdline.rs? I don't speak Rust, but I was reading through the src anyways and found this: I compared the mentioned file to pir/cmdline.rs and there you use "Option" in line 22: pub on: Option<bool>, while statusled/cmdline.rs reads like this: pub on: bool,

QuantumEntangledAndy commented 11 months ago

It's probably not the Option. We use Option in pir because is it means we can omit (optional) the on/off and in such cases it will print the status. But status led dosent have that.

I'll have a look at it when I can.

QuantumEntangledAndy commented 11 months ago

P.a. Just noticed in your last test case with full output you omit the f of off and write of. This may just be a typo but just wanted to check

Full Output
$ neolink status-light --config=/usr/local/etc/neolink.toml cam1 of
[2023-10-18T19:32:31Z INFO neolink] Neolink e47a0d5 release
error: 0 values required for '[on|off]' but 1 was provided
EliteGurke commented 11 months ago

It's a typo. Tried on and off several times.

QuantumEntangledAndy commented 11 months ago

Should be fixed in this build, will release with 0.6.3

iam-TJ commented 11 months ago

Confirming the mentioned build does fix this issue; Tested on Argus PT with Debian 12 amd64:

$ ../../release-amd64-bookworm/neolink status-light --config=argusPT.toml argusPT on
[2023-10-31T01:59:35Z INFO  neolink] Neolink 446387a3a0fd05f4be40ce7f0675069c824eb1db release
[2023-10-31T01:59:35Z INFO  neolink::utils] argusPT: Connecting to camera at UID: 95270004T22YP1W5
[2023-10-31T01:59:35Z INFO  neolink_core::bc_protocol] argusPT: Trying local discovery
[2023-10-31T01:59:35Z INFO  neolink_core::bc_protocol] argusPT: Local discovery success 95270004T22YP1W5 at 10.254.1.64:21199
[2023-10-31T01:59:35Z INFO  neolink::utils] argusPT: Logging in
[2023-10-31T01:59:36Z INFO  neolink::utils] argusPT: Connected and logged in
[2023-10-31T01:59:38Z INFO  neolink::common::camthread] argusPT: Camera time is already set: 2023-10-30 17:55:34.0 +08:00:00
[2023-10-31T01:59:41Z INFO  neolink::common::neocam] argusPT: Model Reolink Argus PT
[2023-10-31T01:59:41Z INFO  neolink::common::neocam] argusPT: Firmware Version v3.0.0.1045_22061301
$ ../../release-amd64-bookworm/neolink status-light --config=argusPT.toml argusPT off
[2023-10-31T01:59:46Z INFO  neolink] Neolink 446387a3a0fd05f4be40ce7f0675069c824eb1db release
[2023-10-31T01:59:46Z INFO  neolink::utils] argusPT: Connecting to camera at UID: 95270004T22YP1W5
[2023-10-31T01:59:46Z INFO  neolink_core::bc_protocol] argusPT: Trying local discovery
[2023-10-31T01:59:46Z INFO  neolink_core::bc_protocol] argusPT: Local discovery success 95270004T22YP1W5 at 10.254.1.64:21199
[2023-10-31T01:59:46Z INFO  neolink::utils] argusPT: Logging in
[2023-10-31T01:59:46Z INFO  neolink::utils] argusPT: Connected and logged in
[2023-10-31T01:59:49Z INFO  neolink::common::camthread] argusPT: Camera time is already set: 2023-10-30 17:55:44.0 +08:00:00
[2023-10-31T01:59:51Z INFO  neolink::common::neocam] argusPT: Model Reolink Argus PT
[2023-10-31T01:59:51Z INFO  neolink::common::neocam] argusPT: Firmware Version v3.0.0.1045_22061301