Jeg fiklet litt med dette i september. Jeg endte opp med scrape badevann.no, gjennom node-red. Hvis jeg ikke husker helt feil fikk jeg til det samme fra YR. Men det kan også være at jeg ikke fikk det til ettersom jeg brukte badevann.no. Badevann.no leverer temp til YR.
Jeg er ganske langt fra en å være utvikler, så det er sikkert mye dårlig kode og praksis. Men den rapporterte hvertfall noen dager frem til de tok opp sensoren fra vannet. 🙂
[{"id":"0c39566e81bb8ea4","type":"debug","z":"c57ff172a079b457","name":"","active":false,"console":"false","complete":"false","x":1090,"y":480,"wires":[]},{"id":"7816e081d8cc62cc","type":"http request","z":"c57ff172a079b457","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://badevann.no/sjostrand/index.html","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":330,"y":440,"wires":[["a4e03e5132d659fc","7301681fd3aa1562"]]},{"id":"a4e03e5132d659fc","type":"html","z":"c57ff172a079b457","name":"","property":"payload","outproperty":"payload","tag":".container-maaling>p.temperatur","ret":"text","as":"single","x":635.5,"y":440,"wires":[["e414479b3204989a"]]},{"id":"5bd28de075baf5a8","type":"debug","z":"c57ff172a079b457","name":"","active":false,"console":"false","complete":"false","x":1090,"y":440,"wires":[]},{"id":"e414479b3204989a","type":"function","z":"c57ff172a079b457","name":"function 3","func":"msg.payload = msg.payload[0].trim();\nmsg.payload = msg.payload.replace('°', '');\nmsg.payload = msg.payload.replace(',', '.');\nmsg.payload = parseFloat(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":440,"wires":[["5bd28de075baf5a8","0ea7be013cddfc0a"]]},{"id":"7301681fd3aa1562","type":"html","z":"c57ff172a079b457","name":"","property":"payload","outproperty":"payload","tag":".container-maaling>p.observasjon","ret":"html","as":"single","x":640,"y":480,"wires":[["0c39566e81bb8ea4","e7319214d52a1b23"]]},{"id":"2dca4837390903ca","type":"inject","z":"c57ff172a079b457","name":"make request","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10800","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":160,"y":440,"wires":[["7816e081d8cc62cc"]]},{"id":"e7319214d52a1b23","type":"function","z":"c57ff172a079b457","name":"function 4","func":"let string = msg.payload[0];\nstring = string.replaceAll(\"<br/>\", \" \")\nstring = string.split(' ')\n// convert strings to date\n// time\nconst time = string[2]\n\n//day\nlet day = string[4].replace('.', ' ')\nday = day.split(' ')\nday = day[0]\n\n// month\nlet month = string[4].replace('.', ' ')\nmonth = month.split(' ')\nvar month1 = month[1]\n\nmonth1 = month1.toLowerCase();\nvar months = [\"januar\", \"februar\", \"mars\", \"april\", \"mai\", \"juni\", \"juli\", \"august\", \"september\", \"okotber\", \"november\", \"desember\"];\nmonth1 = months.indexOf(month1) + 1;\nif (month1 < 10){\n month1 = \"0\" + month1;\n}\n\n// year\nvar year = string[5].replace(',', '');\n\n//formatted date\nvar fulldate = time + \", \" + day + \"-\" + month1 + \"-\" + year;\n\n//messages\nmsg.payload[0] = time;\nmsg.payload[1] = day;\nmsg.payload[2] = month1;\nmsg.payload[3] = year;\nmsg.payload[4] = fulldate;\n\nmsg.unconverted = string;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":520,"wires":[["dd5cf51d5db1e569","89930a5dc84489d4"]]},{"id":"dd5cf51d5db1e569","type":"debug","z":"c57ff172a079b457","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1070,"y":520,"wires":[]},{"id":"89930a5dc84489d4","type":"ha-sensor","z":"c57ff172a079b457","name":"","entityConfig":"a28569d1428149b7","version":0,"state":"payload[4]","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1070,"y":560,"wires":[[]]},{"id":"0ea7be013cddfc0a","type":"ha-sensor","z":"c57ff172a079b457","name":"temp","entityConfig":"a5f24590b9fa0e64","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1070,"y":400,"wires":[[]]},{"id":"2e2322c710db25e2","type":"comment","z":"c57ff172a079b457","name":"Get bath temperature","info":"","x":480,"y":360,"wires":[]},{"id":"a28569d1428149b7","type":"ha-entity-config","server":"dc0802f6.645fa","deviceConfig":"8feaeddb449a1627","name":"Sea temperature","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Sea temperature"},{"property":"icon","value":"mdi:swim"},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"a5f24590b9fa0e64","type":"ha-entity-config","server":"dc0802f6.645fa","deviceConfig":"8feaeddb449a1627","name":"Sea temp","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Sea temp"},{"property":"icon","value":"mdi:swim"},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"temperature"},{"property":"unit_of_measurement","value":"°C"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"dc0802f6.645fa","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},{"id":"8feaeddb449a1627","type":"ha-device-config","name":"Sea-temp","hwVersion":"","manufacturer":"Node-RED","model":"","swVersion":""}]