Skip to content

Instantly share code, notes, and snippets.

@pabalaba
Last active October 13, 2022 09:30
Show Gist options
  • Save pabalaba/b24e74bc288475c2312530e3e9aaa757 to your computer and use it in GitHub Desktop.
Save pabalaba/b24e74bc288475c2312530e3e9aaa757 to your computer and use it in GitHub Desktop.
[
{
"id": "4d1264dd.d6a01c",
"type": "inject",
"z": "145e416e06fd6825",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "New York",
"payloadType": "str",
"x": 160,
"y": 3720,
"wires": [
[
"6e781012.8d7ce"
]
]
},
{
"id": "6e781012.8d7ce",
"type": "http request",
"z": "145e416e06fd6825",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://api.openweathermap.org/data/2.5/weather?q={{payload}}&appid=15c9b19a8e4d2f9570a497c5f49d0541",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 270,
"y": 3780,
"wires": [
[
"2bdf61842ad6d841",
"0fc79bdd83e076a5",
"5156460ac2fd68db"
]
]
},
{
"id": "ddfa98b1.d14128",
"type": "debug",
"z": "145e416e06fd6825",
"name": "kelvin min",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 3720,
"wires": []
},
{
"id": "2bdf61842ad6d841",
"type": "function",
"z": "145e416e06fd6825",
"name": "function 2",
"func": "\n//In New Tork is 285.57\nmsg.payload = 'In ' + msg.payload.name + ' is ' + msg.payload.main.temp_min + ' kelvin';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 500,
"y": 3720,
"wires": [
[
"ddfa98b1.d14128"
]
]
},
{
"id": "0fc79bdd83e076a5",
"type": "function",
"z": "145e416e06fd6825",
"name": "function 3",
"func": "\n//In New Tork is 285.57\nmsg.payload = 'In ' + msg.payload.name + ' is ' + ((msg.payload.main.temp_min + msg.payload.main.temp_max)/2).toFixed(2) + ' kelvin';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 500,
"y": 3780,
"wires": [
[
"86112e139aa3a9a1"
]
]
},
{
"id": "86112e139aa3a9a1",
"type": "debug",
"z": "145e416e06fd6825",
"name": "kelvin avg",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 3780,
"wires": []
},
{
"id": "f41281e27d79d9d3",
"type": "debug",
"z": "145e416e06fd6825",
"name": "clesius avg",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 3840,
"wires": []
},
{
"id": "5156460ac2fd68db",
"type": "function",
"z": "145e416e06fd6825",
"name": "function 4",
"func": "\n//In New Tork is 285.57\nmsg.payload = 'In ' + msg.payload.name + ' is ' + (((msg.payload.main.temp_min + msg.payload.main.temp_max) / 2) - 273.15).toFixed(2) + ' celsius';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 500,
"y": 3840,
"wires": [
[
"f41281e27d79d9d3"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment