Open mblackstock opened 9 years ago
Not sure if a new node is needed since there is already a nice HTTP request node:
This flow sends a single sensor value to the wotkit as an example. To try it, cut and paste into Node-Red.
A 'real' wotkit node could use OAuth2 and combine the function node with the http request node. I may work on this, but this may work just fine for now.
[
{
"crontab": "",
"id": "6d6c3ea9.9293c",
"name": "send data",
"once": false,
"payload": "{\"value\":34}",
"payloadType": "string",
"repeat": "",
"topic": "",
"type": "inject",
"w": 112,
"wires": [
[
"48a3f6a8.b75c08"
]
],
"x": 173.09091186523438,
"y": 215.0909423828125,
"z": "1e61ce70.e19e32"
},
{
"id": "7a3a9352.85c56c",
"method": "POST",
"name": "blood glucose sensor",
"type": "http request",
"url": "http://wotkit.sensetecnic.com/api/sensors/blood-glucose/data",
"w": 190,
"wires": [
[
"cb5e0048.34a2"
]
],
"x": 423.0909423828125,
"y": 335.0909423828125,
"z": "1e61ce70.e19e32"
},
{
"active": true,
"complete": "true",
"console": "false",
"id": "cb5e0048.34a2",
"name": "",
"type": "debug",
"w": 100,
"wires": [],
"x": 474.0909423828125,
"y": 438.09091186523438,
"z": "1e61ce70.e19e32"
},
{
"func": "\nmsg.headers = {\n 'Content-Type' : 'application/json',\n}\nreturn msg;",
"id": "48a3f6a8.b75c08",
"name": "msg output",
"outputs": 1,
"type": "function",
"w": 126,
"wires": [
[
"7a3a9352.85c56c"
]
],
"x": 338.09091186523438,
"y": 215.09091186523438,
"z": "1e61ce70.e19e32"
}
]
This way we can centralize the real time data processing and connectivity to our upstream servers into node-red.
(We'll keep the direct connection to wotkit with auto registration still as in #11.)