BlueIris v5 with Node-RED
- MQTT Alarmserver
- Steuerung von BlueIris mit MQTT
- Hinzufügen des Live-Videos zu Ihrem Node-RED Dashboard
MQTT Alarmserver
Wir haben unsere Kameras in BlueIris bereits so konfiguriert, dass sie ein MQTT-Update senden, sobald die Software einen Alarm auslöst. Um dieses Ereignis in Node-RED zu verwenden, müssen wir nur einen MQTT IN-Node per Drag & Drop auf unsere Arbeitsfläche ziehen und das Topic definieren, das er abonnieren soll. In meinem Fall war dies BlueIris/MotionAlarm/8015black/
:
Wir werden nun in Node-RED benachrichtigt, wenn BlueIris ein Alarmereignis auslöst - wir erhalten die Nutzlast 1
, sobald ein Ereignis ausgelöst wurde und dieser Alarmzustand fällt wenige Sekunden später wieder auf 0
zurück:
Wir können Alarmereignisse innerhalb des Node-RED Dashboard visualisieren, indem wir einen Dashboard-Liniendiagrammknoten verwenden und diesen mit dem MQTT-Eingangsknoten verbinden:
Wenn Sie auf das Dashboard wechseln, wird Ihnen nun angezeigt, wie oft der Alarm in letzter Zeit ausgelöst wurde:
Steuerung von BlueIris mit MQTT
Nun zu etwas Nützlicherem - wir können den MQTT Eingang verwenden, um die Kamera, die den Alarm ausgelöst hat, in BlueIris in den Vollbildmodus zu schalten. Dazu ändere ich den Payload der Nachricht auf camera=black&fullscreen=1
, wenn ein Alarm ausgelöst wurde, und auf camera=black&escape
, wenn das Alarmereignis endete - siehe BlueIris Admin Command Topics für weitere Optionen.
black
in diesen Payloads ist der Kurzname der Kamera, den ich dieser Kamera in BlueIris zugewiesen habe - bitte ersetzen Sie ihn durch den Kurznamen Ihrer Kamera.
Diese Payload wird dann an einen MQTT OUT-Knoten für das MQTT-Topic BlueIris/admin
gesendet:
Die BlueIris-Benutzeroberfläche schaltet meine Kamera jetzt immer in den Vollbildmodus, wenn sie einen Alarm auslöst.
JSON Flow Export
[{"id":"1ef23583.3125da","type":"mqtt in","z":"d214d2a3.60f88","name":"8015black","topic":"BlueIris/MotionAlarm/8015black/","qos":"1","datatype":"auto","broker":"59e4c061.7fa47","x":80,"y":40,"wires":[["839a411c.c4b58","f4dfe612.41b778"]]},{"id":"839a411c.c4b58","type":"ui_chart","z":"d214d2a3.60f88","name":"Alarm History","group":"bdd83452.7d8268","order":0,"width":0,"height":0,"label":"Alarm History","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":false,"ymin":"0","ymax":"1","removeOlder":"10","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#ff0000","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#0036fa","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":241,"y":40,"wires":[[]]},{"id":"a623cc9e.cbfda","type":"change","z":"d214d2a3.60f88","name":"Fullscreen","rules":[{"t":"set","p":"payload","pt":"msg","to":"camera=black&fullscreen=1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":83,"wires":[["df3ba8df.d06188"]]},{"id":"df3ba8df.d06188","type":"mqtt out","z":"d214d2a3.60f88","name":"BlueIris Admin","topic":"BlueIris/admin","qos":"1","retain":"false","broker":"59e4c061.7fa47","x":526,"y":105,"wires":[]},{"id":"10990716.1b0309","type":"change","z":"d214d2a3.60f88","name":"Escape","rules":[{"t":"set","p":"payload","pt":"msg","to":"camera=black&escape","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":123,"wires":[["df3ba8df.d06188"]]},{"id":"f4dfe612.41b778","type":"switch","z":"d214d2a3.60f88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":200,"y":103,"wires":[["a623cc9e.cbfda"],["10990716.1b0309"]]},{"id":"59e4c061.7fa47","type":"mqtt-broker","z":"","name":"ioBroker","broker":"192.168.2.111","port":"1883","clientid":"Node-RED","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"bdd83452.7d8268","type":"ui_group","z":"","name":"IN-8015 FHD (black)","tab":"1d003210.ddce5e","disp":true,"width":"6","collapse":false},{"id":"1d003210.ddce5e","type":"ui_tab","z":"","name":"ioBroker","icon":"dashboard","disabled":false,"hidden":false}]
Dies ist nur eines von vielen Beispielen. Wir können alle BlueIris Admin Befehl Topics innerhalb von Node-RED verwenden, um die Kontrolle über BlueIris-Funktionen zu übernehmen - wie das Auslösen eines Alarms, das Starten und Stoppen manueller Aufzeichnungen oder das De-/Aktivieren der Bewegungserkennung für Kameras:
black
in diesen Nutzlasten ist der Kurzname der Kamera, den ich dieser Kamera in BlueIris zugewiesen habe - bitte ersetzen Sie ihn durch den Kurznamen Ihrer Kamera.
[{"id":"add74b98.9db1f8","type":"mqtt out","z":"d214d2a3.60f88","name":"BlueIris Admin","topic":"BlueIris/admin","qos":"1","retain":"false","broker":"59e4c061.7fa47","x":380,"y":560,"wires":[]},{"id":"f97d96f.79e1b68","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) Alarm","topic":"","payload":"camera=black&trigger","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":460,"wires":[["add74b98.9db1f8"]]},{"id":"14f1a45.cfe115c","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(white) Alarm","topic":"","payload":"camera=white&trigger","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":500,"wires":[["add74b98.9db1f8"]]},{"id":"ae513885.f9bcc8","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) REC","topic":"","payload":"camera=black&manrec=1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":540,"wires":[["add74b98.9db1f8"]]},{"id":"2de11ac2.95f966","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) STOP","topic":"","payload":"camera=black&manrec=0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":580,"wires":[["add74b98.9db1f8"]]},{"id":"b682ac42.a7c9d","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) MD ON","topic":"","payload":"camera=black&motion=1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":620,"wires":[["add74b98.9db1f8"]]},{"id":"46b0fa99.b16804","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) MD OFF","topic":"","payload":"camera=black&motion=0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":660,"wires":[["add74b98.9db1f8"]]},{"id":"59e4c061.7fa47","type":"mqtt-broker","z":"","name":"ioBroker","broker":"192.168.2.111","port":"1883","clientid":"Node-RED","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Hinzufügen des Live-Videos zu Ihrem Node-RED Dashboard
Um unsere BlueIris JPEG-Videoquelle zum Node-RED Dashboard hinzuzufügen, müssen wir einen HTTP Request Node verwenden:
Dieser Knoten handhabt die Authentifizierung, die wir in Blue Iris eingerichtet haben, und holt sich einen Schnappschuss von unserer Kamera:
Die BlueIris JPEG-Videoquelle ist über die IP-Adresse und den Port unseres BlueIris-Servers verfügbar, z.B. 192.168.2.112:8181
, gefolgt von /image/Kamerakurzname
oder /image/Index
für die Kameraübersicht:
http://192.168.2.112:8181/image/black
http://192.168.2.112:8181/image/Index
black
in diesen Nutzlasten ist der Kurzname der Kamera, den ich dieser Kamera in BlueIris zugewiesen habe - bitte ersetzen Sie ihn durch den Kurznamen Ihrer Kamera.
Ich übergebe das Bild an einen node-red-node-base64 Knoten, so dass ich den folgende Image-Tag verwenden kann, um das Bild auf meinem Dashboard anzuzeigen:
<img src="data:image/jpg;base64,{{msg.payload}}"/>
Beachten Sie, dass die Inject-Knoten so konfiguriert sind, dass sie manuell verwendet werden können. Sie können sie aber auch so einstellen, dass in einem bestimmten Intervall ein Schnappschuss angefordert wird, um am Ende einen Videostream auf Ihrem Dashboard zu erhalten. Oder verbinden Sie den Flow mit dem Alarmeingang MQTT-Knoten - so erhalten Sie jedes Mal, wenn der Alarm ausgelöst wird, ein neues Bild.
[{"id":"92b13759.9f1f78","type":"ui_template","z":"d214d2a3.60f88","group":"bdd83452.7d8268","name":"Black","order":2,"width":"6","height":"4","format":"<img src=\"data:image/jpg;base64,{{msg.payload}}\"/>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":527,"y":860,"wires":[[]]},{"id":"2341ecb1.c86894","type":"inject","z":"d214d2a3.60f88","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":860,"wires":[["5088c5c3.a004ec"]]},{"id":"5088c5c3.a004ec","type":"http request","z":"d214d2a3.60f88","name":"Snapshot","method":"GET","ret":"bin","paytoqs":false,"url":"http://192.168.2.112:8181/image/black","tls":"","persist":false,"proxy":"","authType":"basic","x":257,"y":860,"wires":[["f7b0fb08.fc2618"]]},{"id":"f7b0fb08.fc2618","type":"base64","z":"d214d2a3.60f88","name":"","action":"","property":"payload","x":397,"y":860,"wires":[["92b13759.9f1f78"]]},{"id":"faadd8c0.8d5668","type":"ui_template","z":"d214d2a3.60f88","group":"f9ead57d.88dbb8","name":"Overview","order":2,"width":"12","height":"6","format":"<img src=\"data:image/jpg;base64,{{msg.payload}}\"/>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":537,"y":900,"wires":[[]]},{"id":"79f02a71.38a7e4","type":"inject","z":"d214d2a3.60f88","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":900,"wires":[["89943c2.5de24c"]]},{"id":"89943c2.5de24c","type":"http request","z":"d214d2a3.60f88","name":"Snapshot","method":"GET","ret":"bin","paytoqs":false,"url":"http://192.168.2.112:8181/image/Index","tls":"","persist":false,"proxy":"","authType":"basic","x":257,"y":900,"wires":[["c5048969.16ac48"]]},{"id":"c5048969.16ac48","type":"base64","z":"d214d2a3.60f88","name":"","action":"","property":"payload","x":397,"y":900,"wires":[["faadd8c0.8d5668"]]},{"id":"bdd83452.7d8268","type":"ui_group","z":"","name":"IN-8015 FHD (black)","tab":"1d003210.ddce5e","order":1,"disp":true,"width":"6","collapse":false},{"id":"f9ead57d.88dbb8","type":"ui_group","z":"","name":"BlueIris","tab":"1d003210.ddce5e","order":3,"disp":true,"width":"12","collapse":false},{"id":"1d003210.ddce5e","type":"ui_tab","z":"","name":"ioBroker","icon":"dashboard","disabled":false,"hidden":false}]
Diskutieren Sie diesen Artikel im INSTAR Forum !