Skip to content

Instantly share code, notes, and snippets.

@twatteyneadi
Last active May 18, 2017 20:24
Show Gist options
  • Save twatteyneadi/9626af15ec56cf661ffe70734d3b11e0 to your computer and use it in GitHub Desktop.
Save twatteyneadi/9626af15ec56cf661ffe70734d3b11e0 to your computer and use it in GitHub Desktop.
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","qsDeviceId":"00-17-0d-00-00-38-06-d6","deviceKey":"","deviceType":"","deviceId":"","event":"event","format":"json","name":"","x":629,"y":331,"wires":[]},{"id":"950cedfd.0a177","type":"comment","z":"c2baf2e0.c6144","name":"step 1. configure JsonServer","info":"","x":195,"y":56,"wires":[]},{"id":"75bc8773.0f7818","type":"inject","z":"c2baf2e0.c6144","name":"connect serial port","topic":"","payload":"{ \"managers\": [\"COM13\"] }","payloadType":"json","repeat":"","crontab":"","once":false,"x":278,"y":117,"wires":[["a1074d41.2e556"]]},{"id":"a1074d41.2e556","type":"http request","z":"c2baf2e0.c6144","name":"","method":"PUT","ret":"txt","url":"http://127.0.0.1:8080/api/v1/config/managers","tls":"","x":491,"y":117,"wires":[["2135feb8.4493e2"]]},{"id":"2135feb8.4493e2","type":"debug","z":"c2baf2e0.c6144","name":"","active":true,"console":"false","complete":"statusCode","x":696,"y":120,"wires":[]},{"id":"1e720935.516127","type":"inject","z":"c2baf2e0.c6144","name":"get status","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":245,"y":170,"wires":[["783fd168.2187c"]]},{"id":"783fd168.2187c","type":"http request","z":"c2baf2e0.c6144","name":"","method":"GET","ret":"obj","url":"http://127.0.0.1:8080/api/v1/status","tls":"","x":488,"y":172,"wires":[["78ad7628.bb58f8"]]},{"id":"78ad7628.bb58f8","type":"debug","z":"c2baf2e0.c6144","name":"","active":true,"console":"false","complete":"payload.managers","x":731,"y":170,"wires":[]},{"id":"6085427f.629eec","type":"comment","z":"c2baf2e0.c6144","name":"step 2. send to Watson IoT Quickstart","info":"","x":219,"y":234,"wires":[]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment