QuantumEntangledAndy / neolink

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

No connection with v.0.6.3-rc.2- Error "Missing field time_r" #236

Closed acseven closed 2 months ago

acseven commented 2 months ago

Describe the bug Using v0.6.2 the current yaml file worked and cameras connected (even though only remote connection). Using v0.6.3-rc.2 with the same toml file, cameras do not connect, and logs report the error loop below.

I'm using MQTT only operation mode. Discovery is set to map, but it only works with remote as seen in the log; in fact the camera local IP addresses are ignored altogether, I don't know if that is expected given these are battery powered cameras (solar) or not.

log:

--- VERSIONS ---
add-on version: 0.0.1
[2024-04-15T12:10:38Z INFO  neolink] Neolink d354b90976f3c542cc2bf061e44cc5d06da0b3bc release
neolink version: neolink 0.6.3-rc.2
neolink mode: rtsp
neolink log: info
ATTENTION: if you expected a newer Neolink version, please reinstall this Add-on!
--- Neolink ---
[2024-04-15T12:10:38Z INFO  neolink] Neolink d354b90976f3c542cc2bf061e44cc5d06da0b3bc release
[2024-04-15T12:10:38Z INFO  neolink::rtsp] Starting RTSP Server at 0.0.0.0:8554
[2024-04-15T12:10:38Z INFO  neolink::rtsp] SDM1: Rtsp Starting
[2024-04-15T12:10:38Z INFO  neolink::rtsp] SDM2: Rtsp Starting
[2024-04-15T12:10:38Z INFO  neolink::utils] SDM2: Connecting to camera at Address: 192.168.68.177:9000, UID: REDACTED 
[2024-04-15T12:10:38Z INFO  neolink::utils] SDM1: Connecting to camera at Address: 192.168.68.100:9000, UID: REDACTED 
[2024-04-15T12:10:38Z INFO  neolink_core::bc_protocol] SDM1: Trying TCP discovery
[2024-04-15T12:10:38Z INFO  neolink_core::bc_protocol] SDM2: Trying TCP discovery
[2024-04-15T12:10:38Z INFO  neolink_core::bc_protocol] SDM1: Trying local discovery
[2024-04-15T12:10:41Z INFO  neolink_core::bc_protocol] SDM1: Trying remote discovery
[2024-04-15T12:10:41Z INFO  neolink_core::bc_protocol] SDM2: Trying local discovery
[2024-04-15T12:10:41Z INFO  neolink_core::bc_protocol] SDM1: Trying map discovery
[2024-04-15T12:10:43Z INFO  neolink_core::bc_protocol] SDM1: Remote discovery success REDACTED at 192.168.68.100:42353
[2024-04-15T12:10:43Z INFO  neolink::utils] SDM1: Logging in
[2024-04-15T12:10:43Z INFO  neolink_core::bc_protocol] SDM2: Trying remote discovery
[2024-04-15T12:10:43Z ERROR neolink_core::bcudp::de] decrypted_payload: Ok("<P2P>\n<D2C_CFM>\n<sid>30423596</sid>\n<conn>local</conn>\n<rsp>0</rsp>\n<cid>994029932</cid>\n<did>32</did>\n</D2C_CFM>\n</P2P>\n")
[2024-04-15T12:10:43Z ERROR neolink_core::bcudp::de] e: Custom("missing field `time_r`")
[2024-04-15T12:10:43Z INFO  neolink_core::bc_protocol] SDM2: Trying map discovery
[2024-04-15T12:10:44Z INFO  neolink::utils] SDM1: Connected and logged in
[2024-04-15T12:10:46Z INFO  neolink::common::camthread] SDM1: Camera time is already set: 2024-04-15 13:10:42.0 +00:00:00

more:

[2024-04-15T12:12:15Z INFO  neolink_core::bc_protocol] SDM1: Trying map discovery
[2024-04-15T12:12:17Z INFO  neolink_core::bc_protocol] SDM1: Remote discovery success REDACTED at 192.168.68.100:42353
[2024-04-15T12:12:17Z INFO  neolink::utils] SDM1: Logging in
[2024-04-15T12:12:18Z INFO  neolink_core::bc_protocol] SDM2: Trying remote discovery
[2024-04-15T12:12:18Z INFO  neolink::utils] SDM1: Connected and logged in
[2024-04-15T12:12:18Z ERROR neolink_core::bcudp::de] decrypted_payload: Ok("<P2P>\n<D2C_CFM>\n<sid>30429336</sid>\n<conn>local</conn>\n<rsp>0</rsp>\n<cid>968618611</cid>\n<did>128</did>\n</D2C_CFM>\n</P2P>\n")
[2024-04-15T12:12:18Z ERROR neolink_core::bcudp::de] e: Custom("missing field `time_r`")
[2024-04-15T12:12:18Z INFO  neolink_core::bc_protocol] SDM2: Trying map discovery
[2024-04-15T12:12:20Z INFO  neolink::common::camthread] SDM1: Camera time is already set: 2024-04-15 13:12:17.0 +00:00:00
[2024-04-15T12:12:23Z WARN  neolink::common::camthread] SDM1: Connection Lost: Nom Parsing error: Nom Error: VerboseError { errors: [([], Nom(MapRes)), ([], Context("Unable to parse Extension XML"))] }
[2024-04-15T12:12:23Z INFO  neolink::common::camthread] SDM1: Attempt reconnect in 5s
[2024-04-15T12:12:28Z INFO  neolink::utils] SDM1: Connecting to camera at Address: 192.168.68.100:9000, UID: REDACTED 
[2024-04-15T12:12:28Z INFO  neolink_core::bc_protocol] SDM1: Trying TCP discovery
[2024-04-15T12:12:28Z INFO  neolink_core::bc_protocol] SDM1: Trying local discovery
[2024-04-15T12:12:28Z INFO  neolink_core::bc_protocol] SDM1: Trying remote discovery
[2024-04-15T12:12:28Z INFO  neolink_core::bc_protocol] SDM1: Trying map discovery
[2024-04-15T12:12:30Z INFO  neolink_core::bc_protocol] SDM1: Remote discovery success REDACTED at 192.168.68.100:42353
[2024-04-15T12:12:30Z INFO  neolink::utils] SDM1: Logging in
[2024-04-15T12:12:31Z INFO  neolink::utils] SDM1: Connected and logged in
[2024-04-15T12:12:33Z INFO  neolink::common::camthread] SDM1: Camera time is already set: 2024-04-15 13:12:29.0 +00:00:00
[2024-04-15T12:12:33Z WARN  neolink::common::camthread] SDM2: Connection Lost: Failed to connect to camera SDM2 at Address: 192.168.68.177:9000, UID: 95270006M2LN1BDJ on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2024-04-15T12:12:33Z INFO  neolink::common::camthread] SDM2: Attempt reconnect in 800ms
[2024-04-15T12:12:34Z INFO  neolink::utils] SDM2: Connecting to camera at Address: 192.168.68.177:9000, UID: REDACTED 
[2024-04-15T12:12:34Z INFO  neolink_core::bc_protocol] SDM2: Trying TCP discovery
[2024-04-15T12:12:35Z WARN  neolink::common::camthread] SDM1: Connection Lost: Nom Parsing error: Nom Error: VerboseError { errors: [([], Nom(MapRes)), ([], Context("Unable to parse Extension XML"))] }
[2024-04-15T12:12:35Z INFO  neolink::common::camthread] SDM1: Attempt reconnect in 5s
[2024-04-15T12:12:37Z INFO  neolink_core::bc_protocol] SDM2: Trying local discovery
[2024-04-15T12:12:39Z INFO  neolink_core::bc_protocol] SDM2: Trying remote discovery
[2024-04-15T12:12:39Z ERROR neolink_core::bcudp::de] decrypted_payload: Ok("<P2P>\n<D2C_CFM>\n<sid>30430583</sid>\n<conn>local</conn>\n<rsp>0</rsp>\n<cid>-918157250</cid>\n<did>144</did>\n</D2C_CFM>\n</P2P>\n")
[2024-04-15T12:12:39Z ERROR neolink_core::bcudp::de] e: Custom("missing field `time_r`")
[2024-04-15T12:12:39Z INFO  neolink_core::bc_protocol] SDM2: Trying map discovery
[2024-04-15T12:12:40Z INFO  neolink::utils] SDM1: Connecting to camera at Address: 192.168.68.100:9000, UID: REDACTED 
[2024-04-15T12:12:40Z INFO  neolink_core::bc_protocol] SDM1: Trying TCP discovery
[2024-04-15T12:12:40Z INFO  neolink_core::bc_protocol] SDM1: Trying local discovery
[2024-04-15T12:12:41Z INFO  neolink_core::bc_protocol] SDM1: Trying remote discovery
[2024-04-15T12:12:41Z INFO  neolink_core::bc_protocol] SDM1: Trying map discovery
[2024-04-15T12:12:43Z INFO  neolink_core::bc_protocol] SDM1: Remote discovery success REDACTED  at 192.168.68.100:42353
[2024-04-15T12:12:43Z INFO  neolink::utils] SDM1: Logging in
[2024-04-15T12:12:43Z INFO  neolink::utils] SDM1: Connected and logged in
[2024-04-15T12:12:46Z INFO  neolink::common::camthread] SDM1: Camera time is already set: 2024-04-15 13:12:42.0 +00:00:00
[2024-04-15T12:12:48Z WARN  neolink::common::camthread] SDM1: Connection Lost: Nom Parsing error: Nom Error: VerboseError { errors: [([], Nom(MapRes)), ([], Context("Unable to parse Extension XML"))] }
[2024-04-15T12:12:48Z INFO  neolink::common::camthread] SDM1: Attempt reconnect in 5s
[2024-04-15T12:12:53Z INFO  neolink::utils] SDM1: Connecting to camera at Address: 192.168.68.100:9000, UID: REDACTED 
[2024-04-15T12:12:53Z INFO  neolink_core::bc_protocol] SDM1: Trying TCP discovery
[2024-04-15T12:12:53Z INFO  neolink_core::bc_protocol] SDM1: Trying local discovery
[2024-04-15T12:12:54Z INFO  neolink_core::bc_protocol] SDM1: Trying remote discovery
[2024-04-15T12:12:54Z INFO  neolink_core::bc_protocol] SDM1: Trying map discovery
[2024-04-15T12:12:54Z WARN  neolink::common::camthread] SDM2: Connection Lost: Failed to connect to camera SDM2 at Address: 192.168.68.177:9000, UID: 95270006M2LN1BDJ on channel 0

    Caused by:
        Timed out while waiting for camera reply
[2024-04-15T12:12:54Z INFO  neolink::common::camthread] SDM2: Attempt reconnect in 1.6s
[2024-04-15T12:12:56Z INFO  neolink_core::bc_protocol] SDM1: Remote discovery success REDACTED at 192.168.68.100:42353
[2024-04-15T12:12:56Z INFO  neolink::utils] SDM1: Logging in
[2024-04-15T12:12:56Z INFO  neolink::utils] SDM2: Connecting to camera at Address: 192.168.68.177:9000, UID: REDACTED 
[2024-04-15T12:12:56Z INFO  neolink_core::bc_protocol] SDM2: Trying TCP discovery

To Reproduce As specified in the description.

Expected behavior Cameras would connect and become available.

Versions NVR software: N/A Neolink software: N/A Reolink camera model and firmware:

neolink.toml file

bind = "0.0.0.0"

[mqtt]
broker_addr = "192.168.68.111"
port = 1883
credentials = ["REDACTED", "REDACTED"]

[[cameras]]
name = "SDM1"
username = "admin"
password = "REDACTED"
address = "192.168.68.100:9000"
uid = "REDACTED"
discovery = "map"    # (map, remote, local, relay)

idle_disconnect = true
buffer_size = 0
print_format = "Xml"  # (None, Human, Xml)

  [cameras.pause]
  on_motion = true # Should pause when no motion
  on_client = true # Should pause when no rtsp client
  timeout = 2.1 # How long to wait after motion stops before pausing

  [cameras.mqtt]
  enable_motion = false        # motion detection
  enable_light = false         # flood lights only available on some camera
  enable_battery = true       # battery updates in `/status/battery_level`
  enable_preview = false       # preview image in `/status/preview`
  enable_floodlight = false    # preview image in `/status/floodlight_tasks`
  battery_update = 10000        # Number of ms between `/status/battery_level` updates
  preview_update = 10000        # Number of ms between `/status/preview` updates
  floodlight_update = 10000     # Number of ms between `/status/floodlight_tasks` updates

    [cameras.mqtt.discovery]
    topic = "homeassistant"
    features = ["pt", "floodlight", "battery", "camera", "motion", "ir"] 

[[cameras]]
name = "SDM2"
username = "admin"
password = "REDACTED"
address = "192.168.68.177:9000"
uid = "REDACTED"
discovery = "map"    # (map, remote, local, relay)

idle_disconnect = true
buffer_size = 0
print_format = "Xml"  # (None, Human, Xml)

  [cameras.pause]
  on_motion = true # Should pause when no motion
  on_client = true # Should pause when no rtsp client
  timeout = 2.1 # How long to wait after motion stops before pausing

  [cameras.mqtt]
  enable_motion = false        # motion detection
  enable_light = false         # flood lights only available on some camera
  enable_battery = true       # battery updates in `/status/battery_level`
  enable_preview = false       # preview image in `/status/preview`
  battery_update = 10000        # Number of ms between `/status/battery_level` updates
  preview_update = 10000        # Number of ms between `/status/preview` updates

    [cameras.mqtt.discovery]
    topic = "homeassistant"
    features = ["battery", "camera", "motion", "ir"] 

v0.6.2 logs, for reference:

--- VERSIONS ---
add-on version: 0.0.9
[2024-04-15T12:00:03Z INFO  neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release
neolink version: neolink 0.6.2
neolink mode: mqtt
neolink log: info
ATTENTION: if you expected a newer Neolink version, please reinstall this Add-on!
--- Neolink ---
[2024-04-15T12:00:03Z INFO  neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release
[2024-04-15T12:00:03Z INFO  neolink::mqtt] SDM1: MQTT Staring
[2024-04-15T12:00:03Z INFO  neolink::mqtt] SDM2: MQTT Staring
[2024-04-15T12:00:03Z INFO  neolink::utils] SDM1: Connecting to camera at Address: 192.168.68.100:9000, UID: REDACTED
[2024-04-15T12:00:03Z INFO  neolink_core::bc_protocol] SDM1: Trying TCP discovery
[2024-04-15T12:00:03Z INFO  neolink::utils] SDM2: Connecting to camera at Address: 192.168.68.177:9000, UID: REDACTED
[2024-04-15T12:00:03Z INFO  neolink_core::bc_protocol] SDM2: Trying TCP discovery
[2024-04-15T12:00:03Z INFO  neolink::mqtt::discovery] Enabled MQTT discovery for SDM1 with friendly name Sdm1
[2024-04-15T12:00:03Z INFO  neolink::mqtt::discovery] Enabled MQTT discovery for SDM2 with friendly name Sdm2
[2024-04-15T12:00:03Z INFO  neolink_core::bc_protocol] SDM1: Trying local discovery
[2024-04-15T12:00:05Z INFO  neolink_core::bc_protocol] SDM1: Trying remote discovery
[2024-04-15T12:00:05Z INFO  neolink_core::bc_protocol] SDM1: Trying map discovery
[2024-04-15T12:00:06Z INFO  neolink_core::bc_protocol] SDM2: Trying local discovery
[2024-04-15T12:00:07Z INFO  neolink_core::bc_protocol] SDM1: Remote discovery success REDACTED at 192.168.68.100:42353
[2024-04-15T12:00:07Z INFO  neolink::utils] SDM1: Logging in
[2024-04-15T12:00:08Z INFO  neolink::utils] SDM1: Connected and logged in
[2024-04-15T12:00:08Z INFO  neolink::common::camthread] SDM1: Camera time is already set: 2024-04-15 13:00:04.0 +00:00:00
[2024-04-15T12:00:09Z INFO  neolink::common::neocam] SDM1: Model Reolink TrackMix
[2024-04-15T12:00:09Z INFO  neolink::common::neocam] SDM1: Firmware Version v3.0.0.1540_22112201
[2024-04-15T12:00:09Z INFO  neolink_core::bc_protocol] SDM2: Trying remote discovery
[2024-04-15T12:00:09Z INFO  neolink_core::bc_protocol] SDM2: Trying map discovery
[2024-04-15T12:00:11Z INFO  neolink_core::bc_protocol] SDM2: Remote discovery success REDACTED at 192.168.68.117:41568
[2024-04-15T12:00:11Z INFO  neolink::utils] SDM2: Logging in
[2024-04-15T12:00:15Z INFO  neolink::utils] SDM2: Connected and logged in
[2024-04-15T12:00:15Z INFO  neolink::common::camthread] SDM2: Camera time is already set: 2024-04-15 13:00:12.0 +00:00:00
[2024-04-15T12:00:15Z INFO  neolink::common::neocam] SDM2: Model Argus Eco Ultra
[2024-04-15T12:00:15Z INFO  neolink::common::neocam] SDM2: Firmware Version v3.0.0.2738_23092700
QuantumEntangledAndy commented 2 months ago

It seems your using docker linked to latest (which means you are ahead of 0.6.3-rc2). Because of changes upstream I've had to drop the older yaserde xml parser. Instead we are now using quick_xml. Quick xml is much more strict about the format of the xml and so will now give error messages if a packet does not match (rather then ignoring it).

I've got a few more message format updates in my testing branch that address this and other format changes and I'll merge them in when I can.

However perhaps you should change your docker to pin to the actual 0.6.3-rc2 instead of tracking latest until it's done

acseven commented 2 months ago

Ah, I see. Thanks for the heads up!

jzuellig commented 1 month ago

However perhaps you should change your docker to pin to the actual 0.6.3-rc2 instead of tracking latest until it's done

I used the [v0.6.3.rc.1] from the docker hub and now my Argus PT Ultra is available via RTSP

Is there a way to control the PTZ functionality via something like onvif?

QuantumEntangledAndy commented 1 month ago

Not via onvif. I can't find any onvif servers in rust that I can hook into. So at the moment it is done via mqtt or command line.