Open choomz opened 10 months ago
Try mqtt.enable_preview
Ok thanks, indeed it look like it works.
Maybe this new question should be in another issue.
My main goal is to save battery. I'm using home assistant, everything works great with MQTT but the RTSP stream is a bit laggy to start (or even never start).
When I connect with VLC, everything is ok, but with the HA card it does not start if i put some option that should save battery, like:
buffer_size = 0
pause.on_motion = true
pause.on_client = true
pause.timeout = 2.1
and the logs:
[2023-09-05T07:49:32Z INFO neolink_core::bc_protocol] entree: Remote discovery success xxx at 192.168.1.xx:30782
[2023-09-05T07:49:34Z INFO neolink::rtsp::states::loggedin] entree: Camera time is already set: 2023-09-05 9:49:24.0 -01:00:00
[2023-09-05T07:49:34Z INFO neolink::rtsp::states::loggedin] entree: Camera reports firmware version v3.0.0.1045_22061301
[2023-09-05T07:49:34Z INFO neolink::rtsp::states::streaming] entree: Starting video stream Sub Stream (Fluent)
[2023-09-05T07:49:34Z INFO neolink::rtsp] entree: Buffers prepared
[2023-09-05T07:49:34Z INFO neolink::rtsp] entree: Client Pause:: Sub
[2023-09-05T07:49:36Z INFO neolink_core::bc_protocol] entree: Registration with reolink servers failed. Retrying: 1/10
[2023-09-05T07:49:37Z INFO neolink_core::bc_protocol] entree: Trying relay discovery
[2023-09-05T07:49:37Z INFO neolink_core::bc_protocol] entree: Trying remote discovery
[2023-09-05T07:49:37Z INFO neolink_core::bc_protocol] entree: Trying map discovery
[2023-09-05T07:49:38Z INFO neolink::rtsp] entree: Motion Pause
[2023-09-05T07:49:39Z INFO neolink_core::bc_protocol] entree: Remote discovery success xxx at 192.168.1.xx:30782
[2023-09-05T07:49:39Z INFO neolink::mqtt::event_cam] entree: Logging in
[2023-09-05T07:49:40Z INFO neolink::mqtt::event_cam] entree: Connected and logged in
[2023-09-05T07:49:40Z INFO neolink::mqtt::event_cam] entree: Listening to Camera Motion
[2023-09-05T07:49:40Z INFO neolink::mqtt::event_cam] entree: Listening to FloodLight Status
[2023-09-05T07:49:40Z INFO neolink::mqtt::event_cam] entree: Updating Battery Level
[2023-09-05T07:49:40Z INFO neolink::mqtt::event_cam] entree: Setting up camera actions
[2023-09-05T07:49:40Z INFO neolink::mqtt::discovery] Enabled MQTT discovery for entree with friendly name Entree
If i understand well, we can see that the stream is paused at first when the container is started, and when I display my card it wakes up, but nothing is shown.
If I remove pause options etc ... it start, but drains battery ...
Do you have any advice ?
Thanks a lot !
How are you running neolink? The MQTT only provided a preview of the image not the actual stream. Whereas the rtsp command will create a stream that is closer to live. If you want live and preview you will need to run two containers one for mqtt and one for rtsp (or make a new image that runs both)
The pause feature is experimental and something I'm constantly working on for improvement (there's no good way to pause a stream without a transcode). I can't tell if your using it right from just your logs. If your using motion and client then it will only resume if there is motion detected and a client connected. Perhaps you should check if your motion detection is setup on the camera with the official client first. Or maybe test just the client pause first to isolate any issues.
Sorry, maybe I didn't make myself clear.
I had a first point to stop the preview every 500ms. It's OK now if you use the right parameter prefix, MQTT no longer updates the preview every 500ms.
The overall point is to save battery power, because when I connect the neolink container to home assistant, the battery is drained very quickly.
I don't know if it's linked to the stream that's open or to the MQTT battery refresh (I'd like to have the true value of my battery in home assistant).
I use the container with the following command in entry point:
command: [ '/bin/bash', '-c', 'neolink rtsp --config=/etc/neolink.toml & neolink mqtt --config=/etc/neolink.toml & wait -n' ]
So I have both the MQTT and RTSP streams on a single container.
The MQTT stream allows me to have the sensors and actions directly in home assistant and the RTSP stream allows me to have an RTSP camera: https://www.home-assistant.io/integrations/generic/#live-stream
In practice, if I don't set pause.on_motion
and pause.on_client
, the stream "works", it takes a while to reconnect or display, but overall it's acceptable. On the other hand, it's active 24 hours a day, so the battery really doesn't last long.
If I disconnect neolink, then the battery lasts all day without any problem with the PIR activated and the streams displayed in the Reolink application.
If I activate neolink, I have 2 hours max of battery life. I'm looking for :
I hope I've made myself clearer. I'm available for testing if necessary. Maybe there's a verbose mode that will allow me to give you more logs? I'd really like the camera to last 24 hours with neolink + the solar panel as it does with just reolink.
Thanks a lot !
This is an Argus PT. I think this uses PIR for motion. PIR is not the same event that triggers the motion detection alarm in other Reolink cameras. (Not sure I've even found a message from the official client that triggers when PIR is fired). I have plans to listen to the android push notifications (which is fired on PIR) but it's not finished being implemented yet. So if I had to guess on_motion won't do anything for you (will always look like no motion). If you have AI detection for faces and cars etc then that is triggered in the motion alarm event but depends on what your camera supports.
Yes, I'd noticed that the motion doesn't trigger via MQTT but that's not a problem because I catch it otherwise.
I use MQTT for battery value and PTZ.
It doesn't change the battery life issue :)
The main point would be to be able to finely control connections to neolink from a conf or MQTT actions to be able to save battery life ... or maybe another way.
I'm still available for testing or help.
So as part of my last major rework, I redid all of the configuration and setup of almost everything to make things all work from a central config that is behind a async watcher that notifies other part of the code when the config change. Then I setup MQTT so that it can adjust the confiuration.
From there you can remove and add camera, change their running stream of disable/enable a camera using MQTT.
It's still not ready yet but if you want to test it is here:
https://github.com/QuantumEntangledAndy/neolink/actions/runs/6205092376
docker pull quantumentangledandy/neolink:refractor-neo_reactor
To use a few changes are required in the config specifically a global MQTT entry
[mqtt]
server = "127.0.0.1"
port = 1883
credentials = ["username", "password"]
[[cameras]]
# Usual cam stuff
It also needs to be started with
neolink mqtt-rtsp --config=configfile.toml
If you can test please do
Interesting things to change are the neolink/config
entry which has a copy of the toml file in it. You can try for example changing the following in that neolink/config
: cameras.enabled = false
to shutdown a camera or cameras.stream = "None"
to disable the rtsp for it
Hello,
That looks great ! I just saw your update, i'll try it in the next days.
Thanks a lot !
WIP disconnect on idle is on the branch feature/push_mqtt
current build seems to be working.
Needs the following idle_disconnect = true
in the toml
[[cameras]]
# usual options like name and pass
idle_disconnect = true
On no active users/motion for 30s is will disconnect the camera. When an active user OR a push notification is received it will reconnect
You can watch it in the mqtt at neolink/camname/status
will swap from connected
to disconnected
also the last push notification raw json data is dumped into neolink/camname/notification
I tested the neo_reactor build last week but did not had time to write down feedbacks ... sorry.
I'll test the new one on the new branch, thanks !
First of all, thanks for your great work. I was desperate when I realised that reolink cameras on batteries couldn't use the API, and then I discovered your work!
Describe the bug I'm trying to stop the preview every 500ms, used the config variable to do it, but MQTT keep receiving new snapshots.
To Reproduce Here is my configuration file :
Expected behavior No MQTT message refreshing on /neolink//status/preview
Versions Neolink software: 0.5.18 Reolink camera model and firmware: Argus PT - v3.0.0.1045_22061301