[Node-RED] Some Examples
Posted: Tue Apr 12, 2016 3:20 pm
I`m using Node-Red for some time now and have created some usage functions. But not all are working yet
MQTT to Domoticz (works)
Note: The data is send by OTmonitor to my MQTT broker and picked up by Node-RED to send it to Domoticz JSON interface
MySQL to Domoticz (issues)
The problem is that the flow gives me the following output and not only the value
MQTT to Domoticz (works)
Note: The data is send by OTmonitor to my MQTT broker and picked up by Node-RED to send it to Domoticz JSON interface
Code: Select all
[{"id":"48aef6ac.596238","type":"mqtt-broker","z":"","broker":"mqtt.domain.nl","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"c960d3e9.369f3","type":"mqtt in","z":"15db5742.ea24a9","name":"","topic":"events/central_heating/otmonitor/boilerwatertemperature","broker":"48aef6ac.596238","x":324,"y":134,"wires":[["77efb6b9.881048"]]},{"id":"84a421c5.7b5be","type":"debug","z":"15db5742.ea24a9","name":"","active":false,"console":"false","complete":"payload","x":1175,"y":163,"wires":[]},{"id":"e1da43c7.1e25c","type":"debug","z":"15db5742.ea24a9","name":"","active":false,"console":"false","complete":"false","x":987,"y":30,"wires":[]},{"id":"7a8e615d.8571a","type":"http request","z":"15db5742.ea24a9","name":"IDX7","method":"POST","ret":"txt","url":"http://192.168.110.64:8080/json.htm?type=command¶m=udevice&nvalue=0&idx=7&svalue={{payload}}","x":919,"y":164,"wires":[["84a421c5.7b5be"]]},{"id":"77efb6b9.881048","type":"json","z":"15db5742.ea24a9","name":"","x":701,"y":133,"wires":[["e1da43c7.1e25c","7a8e615d.8571a"]]}]
Code: Select all
[{"id":"ba8f12c8.4570f","type":"MySQLdatabase","z":"","host":"192.168.110.200","port":"3306","db":"database","tz":""},{"id":"675893bb.98a76c","type":"debug","z":"350bd099.caf43","name":"","active":false,"console":"false","complete":"payload","x":1160,"y":183,"wires":[]},{"id":"60d1442d.9f2ebc","type":"debug","z":"350bd099.caf43","name":"","active":false,"console":"false","complete":"false","x":1143,"y":69,"wires":[]},{"id":"936ee025.6c912","type":"http request","z":"350bd099.caf43","name":"IDX20","method":"POST","ret":"txt","url":"http://192.168.110.64:8080/json.htm?type=command¶m=udevice&nvalue=0&idx=20&svalue={{payload}}","x":904,"y":156,"wires":[["675893bb.98a76c"]]},{"id":"cb1dd684.34e228","type":"json","z":"350bd099.caf43","name":"","x":681,"y":79,"wires":[["60d1442d.9f2ebc","936ee025.6c912"]]},{"id":"eea128b5.115ed8","type":"mysql","z":"350bd099.caf43","mydb":"ba8f12c8.4570f","name":"database","x":433,"y":155,"wires":[["cb1dd684.34e228","38f0f2dd.c70f0e"]]},{"id":"5b0aa461.a4f55c","type":"function","z":"350bd099.caf43","name":"Select","func":"msg.topic = \"SELECT value as '' FROM splog WHERE pdu = '4901' AND register = 'omkwht' AND channel = '1' ORDER BY id DESC LIMIT 1\";\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":155,"wires":[["eea128b5.115ed8"]]},{"id":"5ed73170.a128d","type":"http in","z":"350bd099.caf43","name":"","url":"/pdudata","method":"get","swaggerDoc":"","x":97,"y":155,"wires":[["5b0aa461.a4f55c"]]},{"id":"38f0f2dd.c70f0e","type":"http response","z":"350bd099.caf43","name":"","x":666,"y":230,"wires":[]}]
Code: Select all
[{"":6531}]
"payload": 18.19,
"payload": [ { "": 6531 } ],