QuantumEntangledAndy / neolink

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

RTSP and MQTT Dual Mode #70

Closed rpruden closed 1 year ago

rpruden commented 1 year ago

Is it possible to use the RTSP stream and the MQTT mesages at the same time? I am specifically using the plugin inside Home Assistant. It seems that I can run in RTSP mode and view the streams, or I can run in MQTT mode and view the motion events but not both at the same time.

Am I missing something or is there not a way to do both? I am really just looking to be able to detect Motion from these cameras. I have Neolink running in Home Assistant and I pass these cameras through to Scrypted where they then pass through to HomeKit. The only thing I have missing is the Motion Detection and potentially PTZ (but that isn't supported in HomeKit anyways). Is there a way to detect the motion natively without using MQTT or is there a way to send the MQTT messages AND get the RTSP stream running simultaneously?

Sorry If I am just misunderstanding something. Great work so far on all of this!

QuantumEntangledAndy commented 1 year ago

Something like this in the docker entry point file should work:

neolink rtsp --config=pathtotoml &
neolink mqtt --config=pathtotoml &
wait -n
rpruden commented 1 year ago

Something like this in the docker entry point file should work:

neolink rtsp --config=pathtotoml &
neolink mqtt --config=pathtotoml &
wait -n

This is for the plugin that runs within Home Assistant. How would I modify the docker entry file for this plugin and if I modify it, will it revert when I update the plugin?

rpruden commented 1 year ago

It looks like I added a repository from https://github.com/dm82m/hassio-addons that is installing your version of neolink. I could potentially fork his fork and make the changes I think.

QuantumEntangledAndy commented 1 year ago

might also be able to override the CMD to docker but you'd have to be careful with the quoting.

QuantumEntangledAndy commented 1 year ago

Something like this perhaps (you'll likely need to adjust but maybe it can get you started).

CMD = [ '/bin/bash', '-c', 'neolink rtsp --config=config.toml &; neolink mqtt --config=config.toml &; wait -n' ]

There's only three arguments in that CMD

QuantumEntangledAndy commented 1 year ago

Just in case your not aware you should be able to change the CMD without forking but I'm not sure about the specifics for Hasios

rpruden commented 1 year ago

I was able to get it working by forking that repo and then modifying the .sh file. Oe other thing I would like to figure out is how I could schedule the snapshot command to run once every 10 seconds or so.

QuantumEntangledAndy commented 1 year ago
neolink rtsp --config=pathtotoml &
neolink mqtt --config=pathtotoml &
{
  while true; do
    neolink image --config=pathtotoml image.jpg;
    sleep $((10 * 60));
  done;
} &

wait -n

Not sure on the details of the multiple line & haven't done that in awhile. Might be () instead of {}. Maybe experiment.

QuantumEntangledAndy commented 1 year ago

Closing this as it is more of a help thread on how to code bash scripts. Have fun with it and if you really need help you can still ask here and I'll see if it is something I can help with or not.