Edimax Kamera

Edimax Kamera mit MQTT steuern über ein Dashboard

Vor kurzen hab ich die Edimax Kamera IC-7112W gekauft  mit Pan/Tilt Funktion. Dh. die Kamera ist drehbar um 355 Grad und 120 Grad nach oben.

Die Kamera gibt es hier bei Amazon : http://amzn.to/2jY3DIn

Nun wäre es geschickt die Kamera per Fernsteuerbefehle mit MQTT zu steuern, damit sich die Kamera in die gewünschte Richtung dreht. Dazu habe ich einen Raspberry Pi mit Node-Red genutzt und einen einfach Flow programmiert. Als Webinterface benutze ich „node-red-dashboard“ welches auf der laufenden Node-Red Instanz installiert sein muss.

Hier der Code:

[{"id":"b91d8ce4.e051e","type":"debug","z":"5aa7a491.2ffb54","name":"","active":true,"console":"false","complete":"false","x":937,"y":319,"wires":[]},{"id":"d322758d.f12f08","type":"exec","z":"5aa7a491.2ffb54","command":"wget -q http://admin:1234\\@192.168.1.10/camera-cgi/com/ptz.cgi\\?move=home -O /home/pi/cam.txt","addpay":false,"append":"","useSpawn":"","timer":"20","name":"Move Home Position","x":701,"y":190,"wires":[["b91d8ce4.e051e"],[],[]]},{"id":"47a2b9d7.26fa88","type":"exec","z":"5aa7a491.2ffb54","command":"wget -q http://admin:1234\\@192.168.1.10/camera-cgi/com/ptz.cgi\\?move=left -O /home/pi/cam.txt","addpay":false,"append":"","useSpawn":"","timer":"20","name":"Move Cam left","x":674,"y":256,"wires":[["b91d8ce4.e051e"],[],[]]},{"id":"906c9152.6ea86","type":"exec","z":"5aa7a491.2ffb54","command":"wget -q http://admin:1234\\@192.168.1.10/camera-cgi/com/ptz.cgi\\?move=right -O /home/pi/cam.txt","addpay":false,"append":"","useSpawn":"","timer":"20","name":"Move Cam right","x":673,"y":325,"wires":[["b91d8ce4.e051e"],[],[]]},{"id":"d4df073.ab8a7f8","type":"inject","z":"5aa7a491.2ffb54","name":"","topic":"Move","payload":"Home","payloadType":"str","repeat":"","crontab":"","once":false,"x":119,"y":184,"wires":[["d322758d.f12f08"]]},{"id":"4ab4b470.284ac4","type":"function","z":"5aa7a491.2ffb54","name":"Test Function 5","func":"if (msg.payload == \"Home\") {\n return [ msg, null, null, null, null ];\n} else if (msg.payload == \"left\") {\n return [ null, msg, null, null, null ];\n} else if (msg.payload == \"right\") {\n return [null, null, msg, null, null];\n} else if (msg.payload == \"Cam4\") {\n return [null, null, null, msg, null];\n} else {\n return [null, null, null, null, msg];\n}\n\n","outputs":"5","noerr":0,"x":371,"y":388,"wires":[["d322758d.f12f08"],["47a2b9d7.26fa88"],["906c9152.6ea86"],[],[]]},{"id":"c7e8c04b.926eb8","type":"ui_button","z":"5aa7a491.2ffb54","name":"","group":"8da23a71.0d8178","order":0,"width":0,"height":0,"label":"Move Cam Home","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":291,"y":156,"wires":[["d322758d.f12f08"]]},{"id":"927d79d5.12ad9","type":"inject","z":"5aa7a491.2ffb54","name":"","topic":"Move","payload":"left","payloadType":"str","repeat":"","crontab":"","once":false,"x":105,"y":254,"wires":[["47a2b9d7.26fa88"]]},{"id":"8792202d.054ed8","type":"ui_button","z":"5aa7a491.2ffb54","name":"","group":"8da23a71.0d8178","order":0,"width":0,"height":0,"label":"Move Cam left","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":273,"y":224,"wires":[["47a2b9d7.26fa88"]]},{"id":"413add8f.e41244","type":"inject","z":"5aa7a491.2ffb54","name":"","topic":"Move","payload":"right","payloadType":"str","repeat":"","crontab":"","once":false,"x":99,"y":323,"wires":[["906c9152.6ea86"]]},{"id":"e861978d.3a0808","type":"ui_button","z":"5aa7a491.2ffb54","name":"","group":"8da23a71.0d8178","order":0,"width":0,"height":0,"label":"Move Cam right","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":273,"y":293,"wires":[["906c9152.6ea86"]]},{"id":"8682c72a.401468","type":"mqtt in","z":"5aa7a491.2ffb54","name":"","topic":"cam","qos":"2","broker":"1ede92a7.3111ad","x":108,"y":389,"wires":[["4ab4b470.284ac4"]]},{"id":"8da23a71.0d8178","type":"ui_group","z":"","name":"Camera","tab":"7ce546c5.654a4","disp":true,"width":"6"},{"id":"1ede92a7.3111ad","type":"mqtt-broker","z":"","broker":"mqtt.unixweb.de","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"7ce546c5.654a4","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]
Edimax Kamerasteuerung mit MQTT
Es muss natürlich im „EXEC-Node“ die IP-Adresse der Kamera, der Benutzername und Passwort angepasst werden. Der String sieht dann so aus bei mir :
„wget -q http://admin:1234\@192.168.1.10/camera-cgi/com/ptz.cgi\?move=home -O /home/pi/cam.txt“

Die Steuerbefehle für MQTT sind „Home“, „left“ und „right“ und zwar genau exakt in dieser Schreibweise. Die Steuerung kann mit dem Programm „MQTT Dashboard“ durchgeführt werden, welches es kostenlos für Android gibt unter : MQTT Dashboard

MQTT-Dashboard
MQTT-Dashboard

Fernsteuerbefehle für Edimax Kameras

  • http://192.168.2.1/camera-cgi/com/ptz.cgi/?move=up
    Bewegt die Kamera nach oben
  • http://192.168.2.1/camera-cgi/com/ptz.cgi/?move=down
    Bewegt die Kamera nach unten
  • http://192.168.2.1/camera-cgi/com/ptz.cgi/?move=right
    Bewegt die Kamera nach rechts
  • http://192.168.2.1/camera-cgi/com/ptz.cgi/?move=left
    Bewegt die Kamera nach links
  • http://192.168.2.1/camera-cgi/com/ptz.cgi/?gotopresetIndex=1
    Bewegt die Kamera in Voreinstellung Postion 1
  • http://192.168.2.1/camera-cgi/com/ptz.cgi/?gotopresetIndex=2
    Bewegt die Kamera in Voreinstellung Postion 2
  • http://192.168.2.1/camera-cgi/com/ptz.cgi/?gotopresetIndex=3
    Bewegt die Kamera in Voreinstellung Postion 3
  • http://192.168.2.1/camera-cgi/com/ptz.cgi/?gotopresetIndex=4
    Bewegt die Kamera in Voreinstellung Postion 4
  • http://192.168.2.1/camera-cgi/admin/recorder.cgi?action=snapshot
    Erstellt ein Kamerabild und speichert es auf die lokale SD-Karte oder Samba Laufwerk
  • http://192.168.2.1/camera-cgi/public/anonymous.cgi
    Ausgabe Kamera Daten und Einstellungen
  • http://192.168.2.1/camera-cgi/public/getSysteminfo.cgi
    Ausgabe Kamera Daten und Einstellungen
Viel Spaß beim basteln und Kamera steuern wünscht , Joachim

Kommentar hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*