Skip to content

Instantly share code, notes, and snippets.

@twatteyneadi
twatteyneadi / smartmesh_watson_iot_quickstart.json
Last active May 18, 2017 20:24
Node-RED flow to Publish to Watson IoT Quickstart from your SmartMesh IP Network
[{"id":"85aa03bc.2a561","type":"http in","z":"c2baf2e0.c6144","name":"/oap","url":"/oap","method":"post","swaggerDoc":"","x":210,"y":329,"wires":[["b33dbfba.360c2","bed74bc9.84e9f8"]]},{"id":"b33dbfba.360c2","type":"http response","z":"c2baf2e0.c6144","name":"","x":339,"y":380,"wires":[]},{"id":"98a0ab7c.174b78","type":"debug","z":"c2baf2e0.c6144","name":"","active":true,"console":"false","complete":"false","x":568,"y":275,"wires":[]},{"id":"bed74bc9.84e9f8","type":"function","z":"c2baf2e0.c6144","name":"","func":"var motelabel = \"3FFEE6\" // <-- replace this\n\nvar re = /\\-/gi;\nif (\n msg.payload.mac.replace(re,'').endsWith(motelabel.toLowerCase()) &&\n msg.payload.fields.channel_str==\"temperature\"\n ) {\n msg.payload = { d: { 'temperature': msg.payload.fields.samples[0]/100.0 }}\n return msg;\n}","outputs":1,"noerr":0,"x":389,"y":329,"wires":[["98a0ab7c.174b78","50be9b24.6dd204"]]},{"id":"50be9b24.6dd204","type":"wiotp out","z":"c2baf2e0.c6144","authType":"d","qs":"true","qsDevi
@twatteyneadi
twatteyneadi / oap_client.json
Last active November 8, 2019 14:16
A Node-RED Dashboard-based OAP Client for your SmartMesh IP network!
[{"id":"8b29696e.959e28","type":"subflow","name":"PUT","info":"","in":[{"x":142,"y":208.00000762939453,"wires":[{"id":"27105310.8933fc"}]}],"out":[{"x":844.9999847412109,"y":215.00001525878906,"wires":[{"id":"c66ac42c.728748","port":0}]}]},{"id":"46f0a800.bf7d08","type":"http request","z":"8b29696e.959e28","name":"","method":"PUT","ret":"obj","url":"","tls":"","x":485.8957977294922,"y":216.88888549804688,"wires":[["c66ac42c.728748","b6e9f36a.260c7"]]},{"id":"27105310.8933fc","type":"function","z":"8b29696e.959e28","name":"format request","func":"msg.url = \"http://127.0.0.1:8080/api/v1/oap/\"+global.get('mote')+msg.topic\nreturn msg\n","outputs":1,"noerr":0,"x":296.90281677246094,"y":215.57626342773438,"wires":[["46f0a800.bf7d08","b6e9f36a.260c7"]]},{"id":"c66ac42c.728748","type":"change","z":"8b29696e.959e28","name":"","rules":[{"t":"move","p":"statusCode","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":688.6076507568359,"y":219.22222900390625,"wires":[