MQTT & NodeRed support

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
Posts: 1
Joined: Wed Sep 12, 2018 9:59 pm

MQTT & NodeRed support

Post by bradmck » Wed Sep 12, 2018 10:17 pm


I listened to a couple of the devs on FLOSS Weekly (Andrew and Isaac I believe) and talk about integration with other systems came up. They were asked about integrating with other security systems, etc and one of the devs stated that they'd love to have more integration with things down the road. MQTT and NodeRed both came to mind as an easy(ish) ways to be able to increase integration possibilities. In fact someone would just write a NodeRed "Node" to be able to talk to the ZM API - or maybe your event engine? Granted MQTT would take some work on the ZM side but MQTT has libraries available for pretty much all languages and is very lightweight. I don't have the knowledge to code anything up to help but thought it was worth mentioning given the talk on the podcast.

And one of the devs mentioned HomeAssistant thinking they were using the API, and yes, it is HomeAssistant that someone built a "Component" for ZoneMinder for. I don't know what it's doing under the hood but you had the right name.

Also - congrats on the new release!

Posts: 7
Joined: Sun Aug 06, 2017 8:24 pm

Re: MQTT & NodeRed support

Post by kevins » Mon Oct 01, 2018 3:08 am

Here is a working flow that performs a login and then passes cookie to JSON request.

Code: Select all

[{"id":"df9abd12.9df57","type":"inject","z":"b852244.c78c5d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":248,"y":525,"wires":[["62b463e4.f8e27c"]]},{"id":"448767a9.6a3788","type":"http request","z":"b852244.c78c5d8","name":"post","method":"POST","ret":"txt","url":"","tls":"","x":709,"y":525,"wires":[["5977884a.e8e458","96a00cfb.c3323"]]},{"id":"62b463e4.f8e27c","type":"function","z":"b852244.c78c5d8","name":"set login payload and headers","func":"msg.payload = \"username=ADMIN&password=PASSWORD&action=login&view=console\";\nmsg.headers = {};\nmsg.headers['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';\nmsg.headers['Accept-Encoding'] = 'gzip, deflate';\nmsg.headers['Accept-Language'] = 'en-GB,en;q=0.5';\nmsg.headers['Connection'] = 'keep-alive';\nmsg.headers['Content-type'] = 'application/x-www-form-urlencoded';\nmsg.headers['Cookie'] = 'zmSkin=classic; zmCSS=classic;';\nmsg.headers['Host'] = '';\nmsg.headers['Referer'] = '';\nmsg.headers['Upgrade-Insecure-Requests'] = '1';\nmsg.headers['User-Agent'] = 'node-red';\nreturn msg;","outputs":1,"noerr":0,"x":480,"y":525,"wires":[["448767a9.6a3788"]]},{"id":"96a00cfb.c3323","type":"debug","z":"b852244.c78c5d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":985,"y":524,"wires":[]},{"id":"5977884a.e8e458","type":"function","z":"b852244.c78c5d8","name":"set request payload and headers","func":"msg.payload = {};\nmsg.headers = {};\nmsg.headers['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';\nmsg.headers['Accept-Encoding'] = 'gzip, deflate';\nmsg.headers['Accept-Language'] = 'en-GB,en;q=0.5';\nmsg.headers['Cache-Control'] = 'max-age=0';\nmsg.headers['Connection'] = 'keep-alive';\nmsg.headers['Cookie'] = 'zmSkin=classic; zmCSS=classic; ZMSESSID='+msg.responseCookies.ZMSESSID.value;\nmsg.headers['Host'] = '';\nmsg.headers['Upgrade-Insecure-Requests'] = '1';\nmsg.headers['User-Agent'] = 'node-red';\n\n//headers[\"set-cookie\"][0]\n\nreturn msg;","outputs":1,"noerr":0,"x":487,"y":678,"wires":[["f50d7b5c.5a23c8"]]},{"id":"20ee379.f0f59c8","type":"debug","z":"b852244.c78c5d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":979,"y":677,"wires":[]},{"id":"f50d7b5c.5a23c8","type":"http request","z":"b852244.c78c5d8","name":"get","method":"GET","ret":"txt","url":"","tls":"","x":716,"y":677,"wires":[["20ee379.f0f59c8"]]}]

User avatar
Posts: 1448
Joined: Sun Mar 01, 2015 12:12 pm

Re: MQTT & NodeRed support

Post by asker » Wed Oct 03, 2018 12:28 am

MQTT support was recently added to the event notification server.
Please don't ask me questions via PM. Feel free to post in the forums or Github

My collection of ZoneMinder learnings:

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests