Skip to content

Instantly share code, notes, and snippets.

@Matteo29-mar
Created October 13, 2022 09:57
Show Gist options
  • Save Matteo29-mar/eb10008b3a32d0121e1659e40b8532f2 to your computer and use it in GitHub Desktop.
Save Matteo29-mar/eb10008b3a32d0121e1659e40b8532f2 to your computer and use it in GitHub Desktop.
[
{
"id": "4d1264dd.d6a01c",
"type": "inject",
"z": "195a83d011cf9cee",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "New York",
"payloadType": "str",
"x": 340,
"y": 2700,
"wires": [
[
"6e781012.8d7ce"
]
]
},
{
"id": "6e781012.8d7ce",
"type": "http request",
"z": "195a83d011cf9cee",
"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": 530,
"y": 2700,
"wires": [
[
"fc9e87e9c48944c4"
]
]
},
{
"id": "ddfa98b1.d14128",
"type": "debug",
"z": "195a83d011cf9cee",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 930,
"y": 2700,
"wires": []
},
{
"id": "fc9e87e9c48944c4",
"type": "function",
"z": "195a83d011cf9cee",
"name": "function 2",
"func": "var t1 = 'In ';\nvar city = msg.payload.name;\nvar t3 = ' is ';\nvar main_temp = msg.payload.main.temp_min;\n\n var t4 = '\\ntemperature in celsius is:';\n var cel_temp =msg.payload.main.temp - 273 ;\n\n var t5 = '\\nmedium temperature:'\n var md = (msg.payload.main.temp_max +main_temp) /2 ;\nmsg.payload = t1 + city + t3 + main_temp +t4 + cel_temp +t5 + md;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 720,
"y": 2700,
"wires": [
[
"ddfa98b1.d14128"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment