Jasně. Prosím změň si API já jsem vymazal konec GPS.
[{"id":"6eff21b1065e821b","type":"tab","label":"Test - Forecast","disabled":false,"info":"","env":[]},{"id":"cff395a1865a8290","type":"config","z":"6eff21b1065e821b","name":"Flow variables","properties":[{"p":"metNoUrlParams","pt":"flow","to":"{\"lat\":\"50.1386825\",\"lon\":\"14.\"}","tot":"json"}],"active":true,"x":160,"y":100,"wires":[]},{"id":"7045b0865d8d4cdf","type":"cronplus","z":"6eff21b1065e821b","name":"Run at midnight/day","outputField":"payload","timeZone":"Europe/Prague","storeName":"default","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"default","outputs":1,"options":[{"name":"schedule1","topic":"topic","payloadType":"flow","payload":"metNoUrlParams","expressionType":"cron","expression":"0 1 0 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"schedule2","topic":"topic","payloadType":"flow","payload":"metNoUrlParams","expressionType":"cron","expression":"0 1 12 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":160,"y":240,"wires":[["360a1cf52b4d6dd2"]]},{"id":"360a1cf52b4d6dd2","type":"http request","z":"6eff21b1065e821b","name":"","method":"GET","ret":"obj","paytoqs":"query","url":"https://api.met.no/weatherapi/locationforecast/2.0/compact","tls":"445fbf524156a600","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":390,"y":240,"wires":[["f21c3efa82b19b91","9f6c4c4e02d86395"]]},{"id":"4db6941b8877cd3f","type":"debug","z":"6eff21b1065e821b","name":"debug 5","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":240,"wires":[]},{"id":"fdc49c7c518d43ba","type":"inject","z":"6eff21b1065e821b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"trigger","payload":"schedule1","payloadType":"str","x":180,"y":340,"wires":[["7045b0865d8d4cdf"]]},{"id":"f21c3efa82b19b91","type":"function","z":"6eff21b1065e821b","name":"ProcessForecast","func":"let todayForecast = {};\nlet hourlyForecastArr = [];\n\nlet today = new Date();\ntodayForecast['today'] = today.getFullYear() + '-' + ('00' + today.getMonth()).slice(-2) + '-' + ('00' + today.getDate()).slice(-2);\n\nlet httpResponse = msg.payload;\n\nif (httpResponse && httpResponse.properties.timeseries && httpResponse.properties.timeseries.length > 0) {\n for (let idx in httpResponse.properties.timeseries) {\n let frc = httpResponse.properties.timeseries[idx];\n let frcDate = new Date(frc.time);\n if (today.getFullYear() == frcDate.getFullYear() && today.getMonth() == frcDate.getMonth() && today.getDate() == frcDate.getDate()) {\n hourlyForecastArr.push({\n \"hour\": frcDate.getHours(),\n \"temp\": frc.data.instant.details.air_temperature\n })\n }\n }\n}\n\n//node.warn(\"ProcessForecast / hourlyForecastArr (original): \" + JSON.stringify(hourlyForecastArr));\n\n// Sort by temperature - ascending\nhourlyForecastArr.sort(function (a, b) { return a.temp - b.temp });\n//node.warn(\"ProcessForecast / hourlyForecastArr (sorted): \" + JSON.stringify(hourlyForecastArr));\n\n// Remove X lowest values\nhourlyForecastArr = hourlyForecastArr.slice(2);\n//node.warn(\"ProcessForecast / hourlyForecastArr (lowest removed): \" + JSON.stringify(hourlyForecastArr));\n\n// Sort by hour - ascending\nhourlyForecastArr.sort(function (a, b) { return a.hour - b.hour });\n\ntodayForecast.hourly = hourlyForecastArr;\n\nnode.warn(\"ProcessForecast / todayForecast: \" + JSON.stringify(todayForecast));\n\nflow.set('todayForecast', todayForecast);\n\nmsg.payload = 'success';\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":240,"wires":[["4db6941b8877cd3f","9f6c4c4e02d86395"]]},{"id":"ae574389518816cd","type":"inject","z":"6eff21b1065e821b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":680,"wires":[["9604c7b01091037b"]]},{"id":"9604c7b01091037b","type":"function","z":"6eff21b1065e821b","name":"Print forecast","func":"node.warn(flow.get('todayForecast'));\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":680,"wires":[[]]},{"id":"24cdc28e827bab36","type":"cronplus","z":"6eff21b1065e821b","name":"Run 1 min past the hour","outputField":"payload","timeZone":"Europe/Prague","storeName":"default","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"default","outputs":1,"options":[{"name":"schedule1","topic":"topic","payloadType":"default","payload":"","expressionType":"cron","expression":"0 1 * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":190,"y":480,"wires":[["52058f7305cc307a"]]},{"id":"52058f7305cc307a","type":"function","z":"6eff21b1065e821b","name":"CheckHourMatch","func":"let currHour = new Date().getHours();\nnode.warn(\"CheckHourMatch / currHour: \" + currHour);\n\nlet todayFrc = flow.get('todayForecast') || {};\nnode.warn(\"CheckHourMatch / todayFrc: \" + JSON.stringify(todayFrc));\n\nfunction matchHour(arrItem) {\n return arrItem.hour == currHour;\n}\n\nlet hourRec = todayFrc.hourly.find(matchHour);\nnode.warn(\"CheckHourMatch / hourRec: \" + JSON.stringify(hourRec));\n\nif (hourRec && hourRec.temp) {\n msg.payload = 'match';\n\n} else {\n msg.payload = 'no-match';\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":480,"wires":[["d460303b363e4cb5","4db6941b8877cd3f"]]},{"id":"e239130c3c520188","type":"inject","z":"6eff21b1065e821b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"02 00 * * *","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":540,"wires":[["52058f7305cc307a"]]},{"id":"d460303b363e4cb5","type":"switch","z":"6eff21b1065e821b","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"match","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":650,"y":480,"wires":[["f149bd8788fa85e1"],["a1032edb0fc8a34c"]]},{"id":"05364b0dea66e8df","type":"comment","z":"6eff21b1065e821b","name":"Met.no API Parameters","info":"","x":140,"y":60,"wires":[]},{"id":"509fbac100dee645","type":"comment","z":"6eff21b1065e821b","name":"Retrieve forecast","info":"","x":120,"y":200,"wires":[]},{"id":"73a6ce072a523f87","type":"comment","z":"6eff21b1065e821b","name":"Check forecast & execute","info":"","x":150,"y":440,"wires":[]},{"id":"16a091e47192778a","type":"comment","z":"6eff21b1065e821b","name":"Print current forecast","info":"","x":130,"y":640,"wires":[]},{"id":"9f6c4c4e02d86395","type":"flogger","z":"6eff21b1065e821b","name":"DebugLog - Test Forecast","logfile":"hassio-node-red-test-forecast.log","inputchoice":"fullmsg","inputobject":"payload","inputobjectType":"msg","inputmoustache":"Recieved payload {{payload}} and topic {{topic}}","loglevel":"TRACE","logconfig":"ac267ea71d752dcd","sendpane":true,"x":1070,"y":140,"wires":[[]]},{"id":"a1032edb0fc8a34c","type":"api-call-service","z":"6eff21b1065e821b","name":"HDO ON","server":"32d979eb.46fec6","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.tc_switch_temperature_l2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":520,"wires":[[]]},{"id":"f149bd8788fa85e1","type":"api-call-service","z":"6eff21b1065e821b","name":"HDO OFF","server":"32d979eb.46fec6","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.tc_switch_temperature_l2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":380,"wires":[[]]},{"id":"445fbf524156a600","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"Expert_Logic_CA_Bundle.crt","servername":"","verifyservercert":false,"alpnprotocol":""},{"id":"ac267ea71d752dcd","type":"config-log","logname":"Default","logdir":"/share/","stamp":"local","logstyle":"plain","logrotate":true,"logcompress":false,"logrotatecount":"5","logsize":"1000"},{"id":"32d979eb.46fec6","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]