Closed array81 closed 1 year ago
Hi.
To work with more than one camera, just follow the example file where you can see 2 cameras: reolink_cam_1
and onvif_cam_1
. You can add as many as you want keeping the same indentation.
cameras:
cam_1:
host: 192.168.4.1
...
cam_2:
host: 192.168.4.2
...
cam_3:
host: 192.168.4.3
...
To run the docker container on a single command, you need to mount the config file as volume, instead of the directory.
$ docker run -v "/home/array81/cam2mqtt/config.yml:/config.yml" acasal/cam2mqtt
You can simplify the command autodetecting the current directory.
$ docker run -v "${PWD}/config.dev.yml:/config.yml" acasal/cam2mqtt
Keep in mind that running a container like this will keep the container created once the process is finished. Just add --rm
to remove the container once the process is finished.
$ docker run --rm -v "${PWD}/config.dev.yml:/config.yml" acasal/cam2mqtt
I recommend to use docker-compose because it helps with most of the inconveniencies of running docker containers through command line.
Hi, thanks for your reply. I'll use docker compose but before I'd like understand if cofig file is ok so I try to use single command like and I get an error about config file parse. My file is a valid YAML file. This is my config file (I have remove only username and password), I have 3 ONVIF camera:
mqtt:
host: 192.168.188.98
port: 1883
username: XXX
password: XXX
#base_name: cam2mqtt
ssl: false
#required: true # leave it on true (default) to avoid losing messages on startup
cameras:
cam_motion_taverna:
host: 192.168.188.52
username: XXX
password: XXX
modules:
onvif:
port: 80
monitor_events: true
prefer_webhook_subscription: false
cam_motion_soggiorno:
host: 192.168.188.54
username: XXX
password: XXX
modules:
onvif:
port: 80
monitor_events: true
prefer_webhook_subscription: false
cam_motion_mansarda:
host: 192.168.188.53
username: XXX
password: XXX
modules:
onvif:
port: 80
monitor_events: true
prefer_webhook_subscription: false
OK, I have add webhook line to my config file and now it run but I gen many problems, some ideas?
array81@raspberrypi:~ $ docker run -v "/home/array81/cam2mqtt/config.yml:/config.yml" acasal/cam2mqtt [INFO ] 2022-07-25 19:46:23,914 - Slf4jLogger started SLF4J: A number (1) of logging calls during the initialization phase have been intercepted and are SLF4J: now being replayed. These are subject to the filtering rules of the underlying logging system. SLF4J: See also http://www.slf4j.org/codes.html#replay [INFO ] 2022-07-25 19:46:24,830 akka://cam2mqtt/user/mqtt - starting MQTT client... [INFO ] 2022-07-25 19:46:28,628 akka://cam2mqtt/user/mqtt - mqtt client successfully connected [INFO ] 2022-07-25 19:46:28,797 akka://cam2mqtt/user/cameraman - Starting cam CameraInfo(cam_motion_taverna,192.168.188.52,admin,redacted,List(OnvifCameraModuleConfig(80,true,false))) [INFO ] 2022-07-25 19:46:28,814 akka://cam2mqtt/user/cameraman - Starting cam CameraInfo(cam_motion_soggiorno,192.168.188.54,admin,redacted,List(OnvifCameraModuleConfig(80,true,false))) [INFO ] 2022-07-25 19:46:28,820 akka://cam2mqtt/user/cameraman - Starting cam CameraInfo(cam_motion_mansarda,192.168.188.53,admin,redacted,List(OnvifCameraModuleConfig(80,true,false))) [ERROR] 2022-07-25 19:46:36,948 akka://cam2mqtt/user/cameraman/cam_cam_motion_taverna - The connection closed with error: Connection reset by peer akka.stream.StreamTcpException: The connection closed with error: Connection reset by peer [ERROR] 2022-07-25 19:46:36,950 akka://cam2mqtt/user/cameraman/cam_cam_motion_soggiorno - The connection closed with error: Connection reset by peer akka.stream.StreamTcpException: The connection closed with error: Connection reset by peer [ERROR] 2022-07-25 19:46:37,060 akka://cam2mqtt/user/cameraman/cam_cam_motion_soggiorno - Supervisor RestartSupervisor saw failure: escalate failure java.lang.Exception: escalate failure at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:77) at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:75) at akka.actor.typed.internal.BehaviorImpl$ReceiveBehavior.receiveSignal(BehaviorImpl.scala:133) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.InterceptorImpl$$anon$3.apply(InterceptorImpl.scala:67) at akka.actor.typed.internal.AbstractSupervisor.aroundSignal(Supervision.scala:83) at akka.actor.typed.internal.RestartSupervisor.aroundSignal(Supervision.scala:221) at akka.actor.typed.internal.InterceptorImpl.receiveSignal(InterceptorImpl.scala:92) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.adapter.ActorAdapter.handleSignal(ActorAdapter.scala:138) at akka.actor.typed.internal.adapter.ActorAdapter.aroundReceive(ActorAdapter.scala:91) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1(DeathWatch.scala:79) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1$adapted(DeathWatch.scala:70) at scala.Option.foreach(Option.scala:437) at akka.actor.dungeon.DeathWatch.receivedTerminated(DeathWatch.scala:70) at akka.actor.dungeon.DeathWatch.receivedTerminated$(DeathWatch.scala:69) at akka.actor.ActorCell.receivedTerminated(ActorCell.scala:410) at akka.actor.ActorCell.autoReceiveMessage(ActorCell.scala:562) at akka.actor.ActorCell.invoke(ActorCell.scala:545) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270) at akka.dispatch.Mailbox.run(Mailbox.scala:231) at akka.dispatch.Mailbox.exec(Mailbox.scala:243) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [ERROR] 2022-07-25 19:46:37,071 akka://cam2mqtt/user/cameraman/cam_cam_motion_taverna - Supervisor RestartSupervisor saw failure: escalate failure java.lang.Exception: escalate failure at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:77) at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:75) at akka.actor.typed.internal.BehaviorImpl$ReceiveBehavior.receiveSignal(BehaviorImpl.scala:133) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.InterceptorImpl$$anon$3.apply(InterceptorImpl.scala:67) at akka.actor.typed.internal.AbstractSupervisor.aroundSignal(Supervision.scala:83) at akka.actor.typed.internal.RestartSupervisor.aroundSignal(Supervision.scala:221) at akka.actor.typed.internal.InterceptorImpl.receiveSignal(InterceptorImpl.scala:92) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.adapter.ActorAdapter.handleSignal(ActorAdapter.scala:138) at akka.actor.typed.internal.adapter.ActorAdapter.aroundReceive(ActorAdapter.scala:91) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1(DeathWatch.scala:79) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1$adapted(DeathWatch.scala:70) at scala.Option.foreach(Option.scala:437) at akka.actor.dungeon.DeathWatch.receivedTerminated(DeathWatch.scala:70) at akka.actor.dungeon.DeathWatch.receivedTerminated$(DeathWatch.scala:69) at akka.actor.ActorCell.receivedTerminated(ActorCell.scala:410) at akka.actor.ActorCell.autoReceiveMessage(ActorCell.scala:562) at akka.actor.ActorCell.invoke(ActorCell.scala:545) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270) at akka.dispatch.Mailbox.run(Mailbox.scala:231) at akka.dispatch.Mailbox.exec(Mailbox.scala:243) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [INFO ] 2022-07-25 19:46:37,997 akka://cam2mqtt/user/cameraman/cam_cam_motion_mansarda/mod_onvif - ONVIF Capabilities for camera cam_motion_mansarda: [ERROR] 2022-07-25 19:46:41,568 akka://cam2mqtt/user/cameraman/cam_cam_motion_taverna - The connection closed with error: Connection reset by peer akka.stream.StreamTcpException: The connection closed with error: Connection reset by peer [ERROR] 2022-07-25 19:46:41,573 akka://cam2mqtt/user/cameraman/cam_cam_motion_taverna - Supervisor RestartSupervisor saw failure: escalate failure java.lang.Exception: escalate failure at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:77) at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:75) at akka.actor.typed.internal.BehaviorImpl$ReceiveBehavior.receiveSignal(BehaviorImpl.scala:133) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.InterceptorImpl$$anon$3.apply(InterceptorImpl.scala:67) at akka.actor.typed.internal.AbstractSupervisor.aroundSignal(Supervision.scala:83) at akka.actor.typed.internal.RestartSupervisor.aroundSignal(Supervision.scala:221) at akka.actor.typed.internal.InterceptorImpl.receiveSignal(InterceptorImpl.scala:92) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.adapter.ActorAdapter.handleSignal(ActorAdapter.scala:138) at akka.actor.typed.internal.adapter.ActorAdapter.aroundReceive(ActorAdapter.scala:91) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1(DeathWatch.scala:79) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1$adapted(DeathWatch.scala:70) at scala.Option.foreach(Option.scala:437) at akka.actor.dungeon.DeathWatch.receivedTerminated(DeathWatch.scala:70) at akka.actor.dungeon.DeathWatch.receivedTerminated$(DeathWatch.scala:69) at akka.actor.ActorCell.receivedTerminated(ActorCell.scala:410) at akka.actor.ActorCell.autoReceiveMessage(ActorCell.scala:562) at akka.actor.ActorCell.invoke(ActorCell.scala:545) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270) at akka.dispatch.Mailbox.run(Mailbox.scala:231) at akka.dispatch.Mailbox.exec(Mailbox.scala:243) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [ERROR] 2022-07-25 19:46:41,605 akka://cam2mqtt/user/cameraman/cam_cam_motion_soggiorno - The connection closed with error: Connection reset by peer akka.stream.StreamTcpException: The connection closed with error: Connection reset by peer [ERROR] 2022-07-25 19:46:41,614 akka://cam2mqtt/user/cameraman/cam_cam_motion_soggiorno - Supervisor RestartSupervisor saw failure: escalate failure java.lang.Exception: escalate failure at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:77) at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:75) at akka.actor.typed.internal.BehaviorImpl$ReceiveBehavior.receiveSignal(BehaviorImpl.scala:133) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.InterceptorImpl$$anon$3.apply(InterceptorImpl.scala:67) at akka.actor.typed.internal.AbstractSupervisor.aroundSignal(Supervision.scala:83) at akka.actor.typed.internal.RestartSupervisor.aroundSignal(Supervision.scala:221) at akka.actor.typed.internal.InterceptorImpl.receiveSignal(InterceptorImpl.scala:92) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.adapter.ActorAdapter.handleSignal(ActorAdapter.scala:138) at akka.actor.typed.internal.adapter.ActorAdapter.aroundReceive(ActorAdapter.scala:91) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1(DeathWatch.scala:79) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1$adapted(DeathWatch.scala:70) at scala.Option.foreach(Option.scala:437) at akka.actor.dungeon.DeathWatch.receivedTerminated(DeathWatch.scala:70) at akka.actor.dungeon.DeathWatch.receivedTerminated$(DeathWatch.scala:69) at akka.actor.ActorCell.receivedTerminated(ActorCell.scala:410) at akka.actor.ActorCell.autoReceiveMessage(ActorCell.scala:562) at akka.actor.ActorCell.invoke(ActorCell.scala:545) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270) at akka.dispatch.Mailbox.run(Mailbox.scala:231) at akka.dispatch.Mailbox.exec(Mailbox.scala:243) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [ERROR] 2022-07-25 19:46:49,899 akka://cam2mqtt/user/cameraman/cam_cam_motion_soggiorno - The connection closed with error: Connection reset by peer akka.stream.StreamTcpException: The connection closed with error: Connection reset by peer [ERROR] 2022-07-25 19:46:49,904 akka://cam2mqtt/user/cameraman/cam_cam_motion_soggiorno - Supervisor RestartSupervisor saw failure: escalate failure java.lang.Exception: escalate failure at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:77) at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:75) at akka.actor.typed.internal.BehaviorImpl$ReceiveBehavior.receiveSignal(BehaviorImpl.scala:133) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.InterceptorImpl$$anon$3.apply(InterceptorImpl.scala:67) at akka.actor.typed.internal.AbstractSupervisor.aroundSignal(Supervision.scala:83) at akka.actor.typed.internal.RestartSupervisor.aroundSignal(Supervision.scala:221) at akka.actor.typed.internal.InterceptorImpl.receiveSignal(InterceptorImpl.scala:92) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.adapter.ActorAdapter.handleSignal(ActorAdapter.scala:138) at akka.actor.typed.internal.adapter.ActorAdapter.aroundReceive(ActorAdapter.scala:91) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1(DeathWatch.scala:79) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1$adapted(DeathWatch.scala:70) at scala.Option.foreach(Option.scala:437) at akka.actor.dungeon.DeathWatch.receivedTerminated(DeathWatch.scala:70) at akka.actor.dungeon.DeathWatch.receivedTerminated$(DeathWatch.scala:69) at akka.actor.ActorCell.receivedTerminated(ActorCell.scala:410) at akka.actor.ActorCell.autoReceiveMessage(ActorCell.scala:562) at akka.actor.ActorCell.invoke(ActorCell.scala:545) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270) at akka.dispatch.Mailbox.run(Mailbox.scala:231) at akka.dispatch.Mailbox.exec(Mailbox.scala:243) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [ERROR] 2022-07-25 19:46:51,179 akka://cam2mqtt/user/cameraman/cam_cam_motion_taverna - The connection closed with error: Connection reset by peer akka.stream.StreamTcpException: The connection closed with error: Connection reset by peer [ERROR] 2022-07-25 19:46:51,186 akka://cam2mqtt/user/cameraman/cam_cam_motion_taverna - Supervisor RestartSupervisor saw failure: escalate failure java.lang.Exception: escalate failure at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:77) at net.bfgnet.cam2mqtt.camera.Camera$$anonfun$net$bfgnet$cam2mqtt$camera$Camera$$routing$2.applyOrElse(Camera.scala:75) at akka.actor.typed.internal.BehaviorImpl$ReceiveBehavior.receiveSignal(BehaviorImpl.scala:133) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.InterceptorImpl$$anon$3.apply(InterceptorImpl.scala:67) at akka.actor.typed.internal.AbstractSupervisor.aroundSignal(Supervision.scala:83) at akka.actor.typed.internal.RestartSupervisor.aroundSignal(Supervision.scala:221) at akka.actor.typed.internal.InterceptorImpl.receiveSignal(InterceptorImpl.scala:92) at akka.actor.typed.Behavior$.interpret(Behavior.scala:273) at akka.actor.typed.Behavior$.interpretSignal(Behavior.scala:236) at akka.actor.typed.internal.adapter.ActorAdapter.handleSignal(ActorAdapter.scala:138) at akka.actor.typed.internal.adapter.ActorAdapter.aroundReceive(ActorAdapter.scala:91) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1(DeathWatch.scala:79) at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1$adapted(DeathWatch.scala:70) at scala.Option.foreach(Option.scala:437) at akka.actor.dungeon.DeathWatch.receivedTerminated(DeathWatch.scala:70) at akka.actor.dungeon.DeathWatch.receivedTerminated$(DeathWatch.scala:69) at akka.actor.ActorCell.receivedTerminated(ActorCell.scala:410) at akka.actor.ActorCell.autoReceiveMessage(ActorCell.scala:562) at akka.actor.ActorCell.invoke(ActorCell.scala:545) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270) at akka.dispatch.Mailbox.run(Mailbox.scala:231) at akka.dispatch.Mailbox.exec(Mailbox.scala:243) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Sry for the delay.
The origin of the error is Connection reset by peer akka.stream.StreamTcpException
. Make sure the camera exposes ONVIF interface on port 80. Some cameras use a different port for ONVIF or need to be enabled on camera settings.
I'm sure that port is 80 because I use it on my NVR besides I use it with onvif2mqtt and it works.
Is possible have information about how install and configure it to works with more that one camera?
I have installed the docker image and create a config.yml file but when I try to run
docker run -v /home/array81/cam2mqtt:/config acasal/cam2mqtt
I get error about config file not found but the config.yml is inside /home/array81/cam2mqtt folder