QuantumEntangledAndy / neolink

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

Unable to start mqtt using docker compose #240

Closed CodeFatherG closed 2 months ago

CodeFatherG commented 2 months ago

Describe the bug

When running a compose with the NEO_LINK_MODE env set to mqtt or rtsp-mqtt. When browsing issues to find a resolution I came across #237 whos logs contain [2024-04-16T06:58:57Z INFO neolink::mqtt] frontdrive: MQTT Starting of which mine do not indicating this environment is not being set.

To Reproduce

Steps to reproduce the behavior. Example:

  1. Configuration File
    
    **bind = "0.0.0.0"

[[users]] name = "admin" pass = "..."

[[cameras]] name = "front" discovery = "local" username = "admin" password = "..." address = "..." uid = "..." idle_disconnect = true

stream = "Main"

[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

[mqtt] broker_addr = "127.0.0.1" port = 1883 credentials = ["user1", "..."]**

1. Compose file

version: '3.8' services: neolink: image: quantumentangledandy/neolink:v0.6.2 container_name: neolink ports:

Logs

root@debian:/docker/neolink# docker compose up -d
[+] Running 1/1
 ✔ Container neolink  Started                                                                                                                                                                               0.0s
root@debian:/docker/neolink# docker exec neolink env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=debian
NEO_LINK_MODE=mqtt
HOME=/root
root@debian:/docker/neolink# docker logs neolink
[2024-04-23T22:02:43Z INFO  neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release
[2024-04-23T22:02:44Z INFO  neolink::rtsp] front: Rtsp Staring
[2024-04-23T22:02:44Z INFO  neolink::utils] front: Connecting to camera at Address: ..., UID: ...
[2024-04-23T22:02:44Z INFO  neolink_core::bc_protocol] front: Trying TCP discovery
[2024-04-23T22:02:44Z INFO  neolink::rtsp] Starting RTSP Server at 0.0.0.0:8554
[2024-04-23T22:02:44Z WARN  neolink::rtsp] Without a server certificate, usernames and passwords will be exchanged in plaintext!
[2024-04-23T22:02:44Z INFO  neolink_core::bc_protocol] front: Trying local discovery
[2024-04-23T22:02:45Z INFO  neolink_core::bc_protocol] front: Local discovery success ...at ...:17269
[2024-04-23T22:02:45Z INFO  neolink::utils] front: Logging in
[2024-04-23T22:02:47Z INFO  neolink::utils] front: Connected and logged in
[2024-04-23T22:02:47Z INFO  neolink::common::camthread] front: Camera time is already set: 2024-04-24 8:02:42.0 -10:00:00
[2024-04-23T22:02:47Z INFO  neolink::common::neocam] front: Model Argus Eco Ultra
[2024-04-23T22:02:47Z INFO  neolink::common::neocam] front: Firmware Version v3.0.0.2773_23100910
[2024-04-23T22:02:48Z INFO  neolink::rtsp] front: Avaliable at /front/main, /front/Main, /front/mainStream, /front/MainStream, /front/Mainstream, /front/mainstream, /front
[2024-04-23T22:02:48Z INFO  neolink::rtsp] front: Avaliable at /front/sub, /front/Sub, /front/subStream, /front/SubStream, /front/Substream, /front/substream
CodeFatherG commented 2 months ago

I ended up finding #153 where you have a compose example. Is there a reason that your readme does not have a compose example? The docker indicates that they're enviroments but as we can see from what fixed this issue command: ["/usr/local/bin/neolink", "mqtt-rtsp", "--config=/etc/neolink.toml"] we specifically have to override to command, not set an enviroment

CodeFatherG commented 2 months ago
neolink  | [2024-04-24T11:47:49Z INFO  neolink] Neolink e47a0d5734b0a06b53bd8d78be9ca2f6b8396480 release
neolink  | Error: Failed to parse the "/etc/neolink.toml" config file
neolink  |
neolink  | Caused by:
neolink  |     TOML parse error at line 23, column 70
neolink  |        |
neolink  |     23 |   features = ["floodlight", "camera", "motion", "reboot", "battery", "siren"]
neolink  |        |                                                                      ^^^^^^^
neolink  |     unknown variant `siren`, expected one of `Floodlight`, `Camera`, `Motion`, `Led`, `Ir`, `Reboot`, `Pt`, `Battery`

The documentation is all in lower case but the logs indicate that Camel is required?

QuantumEntangledAndy commented 2 months ago

NEO_LINK_MODE was added by another user. I prefer you just set the command. From their PR that they made I think it's an ENV at image ebuild time not at run time, but I'm not sure. I presume that's how they meant it to be.

The offical case is Camel (because that's how rust prefers enum to be written in the code). However every valid option also allows lower case. Your error here is to do with siren not being in the list of options

CodeFatherG commented 2 months ago

NEO_LINK_MODE was added by another user. I prefer you just set the command. From their PR that they made I think it's an ENV at image ebuild time not at run time, but I'm not sure. I presume that's how they meant it to be.

Yeah the environment tag is for runtime environment, not build time. Perhaps I am just not advanced enough but I can't find how to set build time environments through compose?

Can I suggest adding compose documentation to the readme to help find this? The only way I was able to find this was through one of your comments on an issue as mentioned, otherwise I would have been lost.

CodeFatherG commented 2 months ago

The offical case is Camel (because that's how rust prefers enum to be written in the code). However every valid option also allows lower case. Your error here is to do with siren not being in the list of options

Is the issue that my camera has not reported supporting the siren? The camera does support an audio alarm in the Reolink app, I was hoping to pump this into ha so I can set this up based on away/bedtime.

QuantumEntangledAndy commented 2 months ago

It won't be that this is a config validation error happens before camera logs in. I suspect your just using an old branch before siren was added

CodeFatherG commented 2 months ago

These errors are using v0.6.2 tagged docker image.

QuantumEntangledAndy commented 2 months ago

Yeah 0.6.2 has no Siren as can be seen from the source for that version here https://github.com/QuantumEntangledAndy/neolink/blob/v0.6.2/src/mqtt/discovery.rs

QuantumEntangledAndy commented 2 months ago

Siren first appears in v0.6.3.rc.1 https://github.com/QuantumEntangledAndy/neolink/commit/f56346194e8d56704315d1ef0b44ee9519637592