vongomben / node-red-notes

0 stars 0 forks source link

little test #1

Open vongomben opened 2 years ago

vongomben commented 2 years ago

https://gist.github.com/vongomben/4833445cc83c158fbd54c9a6cfafd616

pabalaba commented 2 years ago

https://gist.github.com/pabalaba/b24e74bc288475c2312530e3e9aaa757

IMNOTIKE commented 2 years ago

https://gist.github.com/IMNOTIKE/0f144a9c42195b6cb1e5ab5d90eef9ed

saramorritti commented 2 years ago

https://gist.github.com/saramorritti/fd9b5e309804f035d4901b2ed3243b14

Rdxv commented 2 years ago

https://gist.github.com/Rdxv/1ed3360fa7ce8d3287889ffbfc92bc89

Wayde2112 commented 2 years ago

https://gist.github.com/Wayde2112/ba17e10767d067574231e2b4cc5bc5b1

Matteo29-mar commented 2 years ago

https://gist.github.com/Matteo29-mar/eb10008b3a32d0121e1659e40b8532f2

LorenzoAvondo commented 2 years ago

https://gist.github.com/LorenzoAvondo/272875e05398274c4995bf6d32595159

vongomben commented 2 years ago

https://gist.github.com/Rdxv/1ed3360fa7ce8d3287889ffbfc92bc89

var text = "in"; var text2 = "temperature is"; var city = msg.payload.name; var tMax = msg.payload.main.temp_max; var tMin = msg.payload.main.temp_min; var tAvgCelsius = ((tMax + tMin)/2)-273.15; msg.payload = text + city + text2 + tAvgCelsius; return msg;

GeassVi commented 2 years ago

https://gist.github.com/GeassVi/cca1ea968dd9190b3eec454caa7a0414

vongomben commented 2 years ago

soluzioni varie con jsonata

[{"id":"3ba5f3a0.40504c","type":"inject","z":"382e6c42.8e461c","name":"","topic":"","payload":"New York","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":420,"y":2400,"wires":[["84aa426c.9b37a"]]},{"id":"84aa426c.9b37a","type":"http request","z":"382e6c42.8e461c","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"http://api.openweathermap.org/data/2.5/weather?q={{payload}}&appid=15c9b19a8e4d2f9570a497c5f49d0541","tls":"","persist":false,"proxy":"","authType":"","x":510,"y":2480,"wires":[["f0549737.75dbc8","39bbae7c.1f61a2","4149ed48.c62114","bc41bbf6.c309c8","fe7ce5d2.a9c758","f7eb9a03.3cd688","a228a272.4ec4a"]]},{"id":"ef4df8a0.94dfe8","type":"comment","z":"382e6c42.8e461c","name":"Compito","info":"nel debug node bisogna evincere \nil nome della città ed \nla temepratura (main) atmosferica\n\nIn <city> is <temp_min>\nIn New Tork is 285.57\n\nCompito in più: Esprimi la \n temperatura in Celsius\nCompito in più: Esprimi la \n temperatura come una \n media tra massima e minima","x":600,"y":2320,"wires":[]},{"id":"f0549737.75dbc8","type":"change","z":"382e6c42.8e461c","name":"jsonata concatenazione","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"In \" & payload.name & \" is \" & payload.main.temp_min","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":2400,"wires":[["f443b5d6.c16828"]]},{"id":"f443b5d6.c16828","type":"debug","z":"382e6c42.8e461c","name":"debug 17","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":980,"y":2340,"wires":[]},{"id":"39bbae7c.1f61a2","type":"change","z":"382e6c42.8e461c","name":"jsonata","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"In \" & payload.name & \" is \" & (payload.main.temp_min-273.15)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":2460,"wires":[["dcf18422.370168"]]},{"id":"dcf18422.370168","type":"debug","z":"382e6c42.8e461c","name":"debug 18","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":980,"y":2460,"wires":[]},{"id":"4149ed48.c62114","type":"change","z":"382e6c42.8e461c","name":"jsonata","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"In \" & payload.name & \" is \" & (payload.main.temp_min+payload.main.temp_max)/2","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":2500,"wires":[["2fcdbf65.bb63c"]]},{"id":"2fcdbf65.bb63c","type":"debug","z":"382e6c42.8e461c","name":"debug 19","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":980,"y":2520,"wires":[]},{"id":"bc41bbf6.c309c8","type":"change","z":"382e6c42.8e461c","name":"Average errore","rules":[{"t":"set","p":"payload","pt":"msg","to":"'City: ' & msg.payload.name \t& '\\nTemp: ' & msg.payload.main.temp\t& '\\nTemp celsius: ' & (msg.payload.main.temp - 273.15)\t& '\\nTemp_average: ' & $average([msg.payload.main.temp_max - msg.payload.main.temp_min])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":2600,"wires":[["489d5b0.d2571a4"]]},{"id":"489d5b0.d2571a4","type":"debug","z":"382e6c42.8e461c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":990,"y":2600,"wires":[]},{"id":"fe7ce5d2.a9c758","type":"change","z":"382e6c42.8e461c","name":"average corretto","rules":[{"t":"set","p":"payload","pt":"msg","to":"'City: ' & msg.payload.name \t& '\\nTemp: ' & msg.payload.main.temp\t& '\\nTemp celsius: ' & (msg.payload.main.temp - 273.15)\t& '\\nTemp_average: ' & $average([msg.payload.main.temp_max, msg.payload.main.temp_min])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":2640,"wires":[["5919b9d2.e755d8"]]},{"id":"5919b9d2.e755d8","type":"debug","z":"382e6c42.8e461c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1010,"y":2680,"wires":[]},{"id":"f7eb9a03.3cd688","type":"change","z":"382e6c42.8e461c","name":"round","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round((payload.main.temp_max+payload.main.temp_min)/2,2)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":2720,"wires":[["727f0be2.6c2c74"]]},{"id":"a228a272.4ec4a","type":"change","z":"382e6c42.8e461c","name":"round semplice","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(payload.main.temp-273.15,2)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":2760,"wires":[["6356b870.595618"]]},{"id":"727f0be2.6c2c74","type":"debug","z":"382e6c42.8e461c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1010,"y":2720,"wires":[]},{"id":"6356b870.595618","type":"debug","z":"382e6c42.8e461c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1010,"y":2760,"wires":[]}]