Haba1234 / ioBroker.onvif

Subscribe to Camera and NVR Events
MIT License
8 stars 10 forks source link

Reolink RLC-420 & RLC-520 #10

Open xdaamg opened 4 years ago

xdaamg commented 4 years ago

Ich teste den Adapter mit Reolink IP-Kameras RLC-420-5MP und RLC-520. Die Kameras werden gefunden und auch angelegt. Ein Vorschaubild wird in der Konfiguration nicht angezeigt. Es werden Objekte angelegt, wenn auch nur eine mit Inhalt "Motion detection". Möglicherweise unterstützt die Kamera auch nicht mehr. Der Wert wird jedoch nicht aktualisiert und bleibt auf "false". In einer vorherigen Version hat es schon einmal funktioniert, wenn auch nur einmalig, dann blieb der Wert nach Bewegungserkennung auf "true" bis die Instanz neu gestartet wurde. Im Logfile gibt es diverse Fehlermeldungen.

Node.js = v10.20.1 js-controller = 2.2.10

Objekte Beispiel: onvif.0.192_168_1_58_8000.connection = true onvif.0.192_168_1_58_8000.subscribeEvents = true onvif.0.192_168_1_58_8000.message.ruleengine.cellmotiondetector.motion.IsMotion = false

onvif.0 2020-04-23 18:00:57.585 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:57.404 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:57.393 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:57.230 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:56.561 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:56.381 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:56.366 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:56.209 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:55.528 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:55.361 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:55.350 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:55.186 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:54.503 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:54.347 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:54.328 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:54.164 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:53.474 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:53.319 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:53.302 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:53.140 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:52.447 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:52.294 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:52.277 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 18:00:52.120 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - Error: ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"}. Resubscribe to events onvif.0 2020-04-23 17:53:49.263 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:49.263 debug (18718) camEvents (192_168_1_58_8000): camMessage = undefined onvif.0 2020-04-23 17:53:49.262 debug (18718) EVENT (192_168_1_58_8000): {"currentTime":"2020-04-23T15:56:09.000Z","terminationTime":"2020-04-23T15:56:33.000Z"} onvif.0 2020-04-23 17:53:49.210 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:49.210 debug (18718) camEvents (192_168_1_56_8000): camMessage = undefined onvif.0 2020-04-23 17:53:49.209 debug (18718) EVENT (192_168_1_56_8000): {"currentTime":"2020-04-23T15:53:14.000Z","terminationTime":"2020-04-23T15:53:38.000Z"} onvif.0 2020-04-23 17:53:49.024 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:49.023 debug (18718) camEvents (192_168_1_59_8000): camMessage = undefined onvif.0 2020-04-23 17:53:49.022 debug (18718) EVENT (192_168_1_59_8000): {"currentTime":"2020-04-23T15:55:31.000Z","terminationTime":"2020-04-23T15:55:55.000Z"} onvif.0 2020-04-23 17:53:48.894 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:48.893 debug (18718) camEvents (192_168_1_57_8000): camMessage = undefined onvif.0 2020-04-23 17:53:48.893 debug (18718) EVENT (192_168_1_57_8000): {"currentTime":"2020-04-23T15:53:36.000Z","terminationTime":"2020-04-23T15:54:00.000Z"} onvif.0 2020-04-23 17:53:37.265 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:37.264 debug (18718) camEvents (192_168_1_58_8000): camMessage = undefined onvif.0 2020-04-23 17:53:37.263 debug (18718) EVENT (192_168_1_58_8000): {"currentTime":"2020-04-23T15:55:57.000Z","terminationTime":"2020-04-23T15:56:33.000Z"} onvif.0 2020-04-23 17:53:37.208 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:37.207 debug (18718) camEvents (192_168_1_56_8000): camMessage = undefined onvif.0 2020-04-23 17:53:37.206 debug (18718) EVENT (192_168_1_56_8000): {"currentTime":"2020-04-23T15:53:02.000Z","terminationTime":"2020-04-23T15:53:38.000Z"} onvif.0 2020-04-23 17:53:37.017 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:37.016 debug (18718) camEvents (192_168_1_59_8000): camMessage = undefined onvif.0 2020-04-23 17:53:37.015 debug (18718) EVENT (192_168_1_59_8000): {"currentTime":"2020-04-23T15:55:19.000Z","terminationTime":"2020-04-23T15:55:55.000Z"} onvif.0 2020-04-23 17:53:36.899 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:36.899 debug (18718) camEvents (192_168_1_57_8000): camMessage = undefined onvif.0 2020-04-23 17:53:36.898 debug (18718) EVENT (192_168_1_57_8000): {"currentTime":"2020-04-23T15:53:24.000Z","terminationTime":"2020-04-23T15:54:00.000Z"} onvif.0 2020-04-23 17:53:25.260 debug (18718) startCameras (192_168_1_58_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:25.259 debug (18718) camEvents (192_168_1_58_8000): camMessage = undefined onvif.0 2020-04-23 17:53:25.258 debug (18718) EVENT (192_168_1_58_8000): {"currentTime":"2020-04-23T15:55:45.000Z","terminationTime":"2020-04-23T15:56:33.000Z"} onvif.0 2020-04-23 17:53:25.210 debug (18718) startCameras (192_168_1_56_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:25.210 debug (18718) camEvents (192_168_1_56_8000): camMessage = undefined onvif.0 2020-04-23 17:53:25.209 debug (18718) EVENT (192_168_1_56_8000): {"currentTime":"2020-04-23T15:52:50.000Z","terminationTime":"2020-04-23T15:53:38.000Z"} onvif.0 2020-04-23 17:53:25.026 debug (18718) startCameras (192_168_1_59_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:25.025 debug (18718) camEvents (192_168_1_59_8000): camMessage = undefined onvif.0 2020-04-23 17:53:25.024 debug (18718) EVENT (192_168_1_59_8000): {"currentTime":"2020-04-23T15:55:07.000Z","terminationTime":"2020-04-23T15:55:55.000Z"} onvif.0 2020-04-23 17:53:24.903 debug (18718) startCameras (192_168_1_57_8000) pullMessages: ERROR - TypeError: Cannot read property 'topic' of undefined. Resubscribe to events onvif.0 2020-04-23 17:53:24.902 debug (18718) camEvents (192_168_1_57_8000): camMessage = undefined onvif.0 2020-04-23 17:53:24.901 debug (18718) EVENT (192_168_1_57_8000): {"currentTime":"2020-04-23T15:53:12.000Z","terminationTime":"2020-04-23T15:54:00.000Z"} onvif.0 2020-04-23 17:53:13.475 debug (18718) state onvif.0.192_168_1_58_8000.connection changed: true (ack = true) onvif.0 2020-04-23 17:53:13.471 debug (18718) state onvif.0.192_168_1_59_8000.connection changed: true (ack = true) onvif.0 2020-04-23 17:53:13.466 debug (18718) state onvif.0.192_168_1_57_8000.connection changed: true (ack = true) onvif.0 2020-04-23 17:53:13.466 debug (18718) state onvif.0.192_168_1_56_8000.connection changed: true (ack = true) onvif.0 2020-04-23 17:53:13.462 debug (18718) createPullPointSubscription: {"subscriptionReference":{"address":{"protocol":"http:","slashes":true,"auth":null,"host":"192.168.1.58:8000","port":"8000","hostname":"192.168.1.58","hash":null," onvif.0 2020-04-23 17:53:13.458 debug (18718) createPullPointSubscription: {"subscriptionReference":{"address":{"protocol":"http:","slashes":true,"auth":null,"host":"192.168.1.59:8000","port":"8000","hostname":"192.168.1.59","hash":null," onvif.0 2020-04-23 17:53:13.452 debug (18718) createPullPointSubscription: {"subscriptionReference":{"address":{"protocol":"http:","slashes":true,"auth":null,"host":"192.168.1.57:8000","port":"8000","hostname":"192.168.1.57","hash":null," onvif.0 2020-04-23 17:53:13.448 debug (18718) createPullPointSubscription: {"subscriptionReference":{"address":{"protocol":"http:","slashes":true,"auth":null,"host":"192.168.1.56:8000","port":"8000","hostname":"192.168.1.56","hash":null," onvif.0 2020-04-23 17:53:13.415 debug (18718) startCameras. cameras: {"onvif.0.192_168_1_58_8000":{"hostname":"192.168.1.58","username":"user","password":"password","port":"8000","path":"/onvif/device_service","timeout":15000,"agent":false onvif.0 2020-04-23 17:53:13.413 debug (18718) classCam. Camera/NVT: {"onvif.0.192_168_1_58_8000":{"hostname":"192.168.1.58","username":"user","password":"password","port":"8000","path":"/onvif/device_service","timeout":15000,"agent":false, onvif.0 2020-04-23 17:53:13.409 debug (18718) classCam. Camera/NVT: {"onvif.0.192_168_1_58_8000":{"hostname":"192.168.1.58","username":"user","password":"password","port":"8000","path":"/onvif/device_service","timeout":15000,"agent":false, onvif.0 2020-04-23 17:53:13.399 debug (18718) classCam. Camera/NVT: {"onvif.0.192_168_1_58_8000":{"hostname":"192.168.1.58","username":"user","password":"password","port":"8000","path":"/onvif/device_service","timeout":15000,"agent":false, onvif.0 2020-04-23 17:53:13.364 debug (18718) classCam. Camera/NVT: {"onvif.0.192_168_1_58_8000":{"hostname":"192.168.1.58","username":"user","password":"password","port":"8000","path":"/onvif/device_service","timeout":15000,"agent":false, onvif.0 2020-04-23 17:53:13.138 debug (18718) state onvif.0.discoveryRunning changed: false (ack = true) onvif.0 2020-04-23 17:53:13.114 debug (18718) classCam: item = {"type":"device","common":{"name":"192.168.1.59:8000"},"native":{"id":"192_168_1_59_8000","name":"192.168.1.59:8000","ip":"192.168.1.59","port":"8000","user":"user","pass":" onvif.0 2020-04-23 17:53:13.114 debug (18718) classCam: item = {"type":"device","common":{"name":"192.168.1.58:8000"},"native":{"id":"192_168_1_58_8000","name":"192.168.1.58:8000","ip":"192.168.1.58","port":"8000","user":"user","pass":" onvif.0 2020-04-23 17:53:13.113 debug (18718) classCam: item = {"type":"device","common":{"name":"192.168.1.57:8000"},"native":{"id":"192_168_1_57_8000","name":"192.168.1.57:8000","ip":"192.168.1.57","port":"8000","user":"user","pass":" onvif.0 2020-04-23 17:53:13.112 debug (18718) classCam: item = {"type":"device","common":{"name":"192.168.1.56:8000"},"native":{"id":"192_168_1_56_8000","name":"192.168.1.56:8000","ip":"192.168.1.56","port":"8000","user":"user","pass":" onvif.0 2020-04-23 17:53:13.111 debug (18718) setCameras: [{"type":"device","common":{"name":"192.168.1.56:8000"},"native":{"id":"192_168_1_56_8000","name":"192.168.1.56:8000","ip":"192.168.1.56","port":"8000","user":"user","pass":" onvif.0 2020-04-23 17:53:13.109 debug (18718) getDevices: [{"type":"device","common":{"name":"192.168.1.56:8000"},"native":{"id":"192_168_1_56_8000","name":"192.168.1.56:8000","ip":"192.168.1.56","port":"8000","user":"user","pass":" onvif.0 2020-04-23 17:53:13.069 debug (18718) startCameras onvif.0 2020-04-23 17:53:13.028 info (18718) starting. Version 0.2.0 in /opt/iobroker/node_modules/iobroker.onvif, node: v10.20.1 onvif.0 2020-04-23 17:53:12.263 debug (18718) statesDB connected onvif.0 2020-04-23 17:53:12.263 debug (18718) States connected to redis: 127.0.0.1:9000 onvif.0 2020-04-23 17:53:12.255 debug (18718) States create System PubSub Client onvif.0 2020-04-23 17:53:12.253 debug (18718) States create User PubSub Client onvif.0 2020-04-23 17:53:12.247 debug (18718) Redis States: Use Redis connection: 127.0.0.1:9000 onvif.0 2020-04-23 17:53:12.244 debug (18718) objectDB connected onvif.0 2020-04-23 17:53:12.237 debug (18718) Objects connected to redis: 127.0.0.1:9001 onvif.0 2020-04-23 17:53:12.218 debug (18718) Objects client initialize lua scripts onvif.0 2020-04-23 17:53:12.217 debug (18718) Objects create User PubSub Client onvif.0 2020-04-23 17:53:12.216 debug (18718) Objects create System PubSub Client onvif.0 2020-04-23 17:53:12.211 debug (18718) Objects client ready ... initialize now onvif.0 2020-04-23 17:53:12.174 debug (18718) Redis Objects: Use Redis connection: 127.0.0.1:9001

Vodochnik commented 3 years ago

Editier mal das Passwort aus dem Log. Wenn cam.renew nicht gefunden wird, wird nicht die aktuelle onvif von github verwendet.

Ich habe die letzten Änderungen aus meinem Repository zurück genommen. Die Bewegungsmeldungen der Reolink Kameras 410, 420, 520 funktionieren damit bei mir (https://github.com/xdaamg/ioBroker.onvif.git).

Danke, bei mir funktioniert's ebenfalls. Allerdings die ganzen Reconnects sind da, nur unter debug. So ganz zufrieden bin ich mit dem Adapter nicht.

xdaamg commented 3 years ago

Den Adapter habe ich inzwischen ersetzt. Ich habe es so gelöst, dass bei Bewegungen die Kamera ein Bild in ein Temp-Verzeichnis schreibt. Das Verzeichnis überwacht der Server mittels inotify. Sobald sich etwas tut, erfolgt die Meldung an iobroker. Mittels etwas Javascript lässt sich ein aktuelles Bild über Telegram verschicken. Funktioniert schnell und zuverlässig.

Vodochnik commented 3 years ago

Ich überlege mir auch so eine Lösung, mit Bild und (auf Anfrage) auch Video. Kannst Du vllt. Deine Scripts posten? Ich meine inotify+Meldung an IOB.

Vodochnik commented 3 years ago

@xdaamg ping:)

xdaamg commented 3 years ago

@Vodochnik Habe den "Ping" jetzt erst bemerkt. Das ist im Prinzip ganz einfach umgesetzt:

  1. Kamera so konfigurieren, dass bei Bewegung ein Bild und/oder Video auf einem Serververzeichnis eines Linux-Servers (z.B. Raspberry Pi) gespeichert wird.
  2. Auf dem Pi muss das Programm inotifywait installiert sein.
  3. Shell-Skript anlegen und bei Start ausführen, auszuschließende Dateien, Pfad, IP & Skriptname anpassen. /media/usb1/cam ist das überwachte Oberverzeichnis. Alle Änderungen unterhalb dieses Pfads werden registriert und in das iobroker-Objekt "kamera_eregnis" mit Pfad gesendet: inotifywait -mrq -e close_write --format %w%f --exclude mp4 /media/usb1/cam/ | while read FILE do curl http://IP_Adresse_ioBroker:8087/set/javascript.0.Kamera.kamera_ereignis?value=$FILE done
  4. Auf der ioBroker-Installation den Adapter "simple-api" bzw. "Einfache RESTful-API" starten und konfigurieren. Im Beispiel oben läuft es auf Port 8087
  5. Jetzt wird bei Ereignissen das Objekt "kamera_ereignis" mit dem Pfad zur Datei (in meinem Fall JPG) aktualisiert. Im iobroker-Skript muss man nur noch darauf reagieren und kann z.B. das Bild mit Text verschicken. on({id: 'javascript.0.Kamera.kamera_ereignis', change: "any"}, function(obj) { var kamera_ereignis = getState('javascript.0.Kamera.kamera_ereignis').val; sendTo('telegram', { text: kamera_ereignis, user: "1", caption: 'Kamera 1: Bewegung erkannt!', type: 'photo' }); });
BiboXXX commented 2 years ago

Total super... Kann dank der obigen Lösung von xdaamg nun auch auf den onvif-Adapter verzichten. Besten Dank!

Nachtrag: Achtung... inotifywait kann nur auf lokale Dateisysteme zugreifen. CIFS-Shares etc. funktionieren nicht.