Advertisement
hrikken

URAD-Domoticz push

Jan 7th, 2019
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 3.22 KB | None | 0 0
  1. [{"id":"7a63db2d.88c1a4","type":"function","z":"af1e9793.0708c8","name":"Fill request with authentication headers","func":"msg.headers = {};\nmsg.headers['X-User-id'] = 'user-id';\nmsg.headers['X-User-hash'] = 'user-key';\n\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":160,"wires":[["db05819a.5fc0f"]]},{"id":"db05819a.5fc0f","type":"http request","z":"af1e9793.0708c8","name":"Call uRad webservice","method":"GET","ret":"obj","url":"https://data.uradmonitor.com/api/v1/devices/<deviceid>/all/60","tls":"","x":880,"y":160,"wires":[["e9c031f.11807d","4939d325.cdc66c"]]},{"id":"55d325f0.95c5dc","type":"inject","z":"af1e9793.0708c8","name":"Read remote uRad data","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":160,"wires":[["7a63db2d.88c1a4"]]},{"id":"e9c031f.11807d","type":"debug","z":"af1e9793.0708c8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1130,"y":280,"wires":[]},{"id":"4939d325.cdc66c","type":"function","z":"af1e9793.0708c8","name":"Convert data to HTTP request","func":"var telegram = msg.payload[0];\n\nvar msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\nvar msg4 = {};\nvar msg5 = {};\nvar msg6 = {};\nvar msg7 = {};\nvar msg8 = {};\nvar msg9 = {};\n\nvar pressure = parseFloat(telegram.pressure) / 100\npressure = pressure.toFixed(0)\npressurestr = pressure.toString();\n\nmsg1.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + telegram.pm25 + \"&svalue=\" + telegram.pm25\nmsg2.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + telegram.vocaqi + \"&svalue=\" + telegram.vocaqi\nmsg3.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + telegram.co2 + \"&svalue=\" + telegram.co2\nmsg4.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + telegram.temperature + \"&svalue=\" + telegram.temperature\nmsg5.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + telegram.humidity + \"&svalue=\" + telegram.humidity\nmsg6.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + pressurestr + \"&svalue=\" + pressurestr\nmsg7.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + telegram.cpm + \"&svalue=\" + telegram.cpm\nmsg8.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + telegram.pm1 + \"&svalue=\" + telegram.pm1\nmsg9.topic = \"json.htm?type=command&param=udevice&idx=xxx&nvalue=\" + telegram.pm10 + \"&svalue=\" + telegram.pm10\n\n\nreturn [msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9];\n\n","outputs":9,"noerr":0,"x":1190,"y":160,"wires":[["b16f2afc.101168"],["b16f2afc.101168"],["b16f2afc.101168"],["b16f2afc.101168"],["b16f2afc.101168"],["b16f2afc.101168"],["b16f2afc.101168","792e5881.314458"],["b16f2afc.101168"],["b16f2afc.101168"]],"outputLabels":["PM2.5","AQI","AQI","Temperature","Humidity","Barometer","Radiation","PM1","PM10"]},{"id":"792e5881.314458","type":"debug","z":"af1e9793.0708c8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","x":1500,"y":280,"wires":[]},{"id":"b16f2afc.101168","type":"http request","z":"af1e9793.0708c8","name":"Push data to Domoticz","method":"GET","ret":"txt","url":"http://127.0.0.1:8080/{{{topic}}}","tls":"","x":1540,"y":160,"wires":[["792e5881.314458"]]}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement