Great Buienradar flow to act on expected rainfall

Voor mijn Nederlandse mede-enthousiastelingen: ik heb een flow gemaakt om de zonwering omhoog te doen als er regen wordt verwacht.
For my fellow Dutch enthusiasts: I made a flow to open my awnings when rain is expected.

complete flow incl. de zonwering bediening:

Buienradar heeft een speciale mogelijkheid die ze "widgets" noemen. Als je deze opvraagt krijg je deze tabel:
Buienradar has a special feature which they call 'widgets'. When called it gives you this table:

buienradar-7

This is geweldig! Het geeft me het inzicht met een 5 minuten interval wanneer regen wordt verwacht en de hoeveelheid!
This is awesome! It gives me the insight with a 5 min. interval when rain is expected and how much!

I continue in Dutch as this is only useful in The Netherlands:

De Buienradar widget:

De flow is nu ingericht om te handelen als er over 1 uur regen wordt verwacht maar dat kan je zelf aanpassen in de functie RAIN EXPECTED?

je wijzigt hiervoor msg.payload[12] in een ander getal.
'0' = nu,
'01'=nu+5min.
'12'=nu+60minuten etc etc.
zie tabel hierboven.

buienradar-9

Uitleg van hun website:

Buienradar widget
(1.0) Neerslagdata op basis van coördinaten

Op basis van de door u gewenste coördinaten (latitude en longitude) kunt u de neerslag
tot twee uur vooruit ophalen in tekstvorm. De data wordt iedere 5 minuten geüpdatet. 
Op deze pagina kunt u de neerslag in tekst vinden. 

De waarde 0 geeft geen neerslag aan (droog), 
de waarde 255 geeft zware neerslag aan. 

Gebruik de volgende formule voor het omrekenen naar de 
neerslagintensiteit in de eenheid millimeter per uur (mm/u):

Neerslagintensiteit = 10^((waarde-109)/32)

Ter controle: een waarde van 77 is gelijk aan een neerslagintensiteit van 0,1 mm/u. 

flow:

[{"id":"506542bac0d4b639","type":"function","z":"faccc2278a3570b0","name":"format message","func":"msg.payload = \"Regen verwacht, markiezen omhoog\";\nmsg.topic = \"INFORMATIE:\"\nmsg.sound = \"bike\";\n//msg.retry = 31;\n//msg.expire = 1800;\nmsg.priority = 0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1630,"y":390,"wires":[["3f17f8b6767eede9"]]},{"id":"3f17f8b6767eede9","type":"ntc-node-red-pushover-notifications","z":"faccc2278a3570b0","keys":"49f08967972432a7","title":"","name":"","x":1800,"y":390,"wires":[[]]},{"id":"9108933555252499","type":"function","z":"faccc2278a3570b0","name":"string array > number","func":"let stringArray = msg.payload;\nlet numberArray = stringArray.map(Number);\nmsg.payload = numberArray;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":450,"wires":[["9e3fb4b4611274ce","44cf4fd0cdf922b4"]]},{"id":"23fd63cf081edfa1","type":"inject","z":"faccc2278a3570b0","name":"check every 10min. (7-22u)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"*/10 7-21 * * *","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":310,"wires":[["3dd704ad3acf4122"]]},{"id":"3dd704ad3acf4122","type":"http request","z":"faccc2278a3570b0","name":"Buienradar HTTP request","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://gpsgadget.buienradar.nl/data/raintext/?lat=50.00&lon=3.00","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"User-Agent","keyValue":"","valueType":"other","valueValue":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"}],"x":210,"y":390,"wires":[["1cf659edde4a4568"]]},{"id":"24cf0dcf3846bc33","type":"inject","z":"faccc2278a3570b0","name":"send test message","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1707,"y":252,"wires":[["cef4e89944793caa"]]},{"id":"e973f5fc49f241f5","type":"trigger","z":"faccc2278a3570b0","name":"send twice with delay","op1":"","op2":"","op1type":"pay","op2type":"payl","duration":"2","extend":false,"overrideDelay":false,"units":"min","reset":"false","bytopic":"all","topic":"topic","outputs":1,"x":1340,"y":450,"wires":[["4de7efe3351a94aa","8e7b3990bfec0193"]],"info":"NOTE: sending the 'original object' does not output anything..."},{"id":"1cf659edde4a4568","type":"csv","z":"faccc2278a3570b0","name":"html data > CSV","sep":"|","hdrin":"","hdrout":"none","multi":"mult","ret":"\\n","temp":"rain,time","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":180,"y":450,"wires":[["84aaf0b2fa82a364","405172543e631fb3"]]},{"id":"84aaf0b2fa82a364","type":"change","z":"faccc2278a3570b0","name":"filter rain data","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload.rain","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":450,"wires":[["9108933555252499","c431b68cb1040c2e"]]},{"id":"405172543e631fb3","type":"debug","z":"faccc2278a3570b0","name":"html data > CSV","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":180,"y":510,"wires":[]},{"id":"f17e0b44eedbfe53","type":"comment","z":"faccc2278a3570b0","name":"UITLEG","info":"Dit is een flow om een actie uit te voeren wanneer er regen wordt verwacht.\n\nHiervoor gebruik ik een Buienradar gadget: \nhttps://www.buienradar.nl/overbuienradar/gratis-weerdata\n\n\nBuienradar widget\n(1.0) Neerslagdata op basis van coördinaten\n\nOp basis van de door u gewenste coördinaten (latitude en longitude) kunt u de neerslag\ntot twee uur vooruit ophalen in tekstvorm. De data wordt iedere 5 minuten geüpdatet. \nOp deze pagina kunt u de neerslag in tekst vinden. \n\nDe waarde 0 geeft geen neerslag aan (droog), \nde waarde 255 geeft zware neerslag aan. \n\nGebruik de volgende formule voor het omrekenen naar de \nneerslagintensiteit in de eenheid millimeter per uur (mm/u):\n\nNeerslagintensiteit = 10^((waarde-109)/32)\n\nTer controle: een waarde van 77 is gelijk aan een neerslagintensiteit van 0,1 mm/u. \n\n[Update 20 juli 2017]: Afgelopen dagen gaf deze widget geen data door. \nDit is inmiddels verbeterd. \nGebruik hiervoor de url https://gps.buienradar.nl/getrr.php?lat=51&lon=3 \nen niet de onderliggende url. \n\n","x":510,"y":250,"wires":[]},{"id":"75c96a3f0e1dd7cf","type":"inject","z":"faccc2278a3570b0","name":"test: value = 88 (RAIN)","props":[{"p":"payload[12]","v":"88","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":660,"y":310,"wires":[["9e3fb4b4611274ce"]]},{"id":"4de7efe3351a94aa","type":"debug","z":"faccc2278a3570b0","name":"send twice with delay","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1340,"y":510,"wires":[]},{"id":"9894a539fa408d94","type":"inject","z":"faccc2278a3570b0","name":"test: value = 0 (NO RAIN)","props":[{"p":"payload[12]","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":670,"y":350,"wires":[["9e3fb4b4611274ce"]]},{"id":"9e3fb4b4611274ce","type":"function","z":"faccc2278a3570b0","name":"rain expected?","func":"var input = msg.payload[12];\n\n// Buienradar data heeft een waarde van 0 - 255\n// 77 bijv. is gelijk aan 0.1mm per uur\n\n// bepaal hieronder bij welke waarde de zonwering\n// omhoog moet gaan\nvar drempelwaarde = 77;\n\n// controleer de drempelwaarde\nif (input >= drempelwaarde) {\n    msg.payload = true;\n}\nelse {\n    msg.payload = false;\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":450,"wires":[["2f8ee8b7309e77b3","1c1defaa05c38bca"]]},{"id":"2f8ee8b7309e77b3","type":"rbe","z":"faccc2278a3570b0","name":"pass if changed","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":1100,"y":450,"wires":[["e973f5fc49f241f5","8dc76ee4573745ff","cef4e89944793caa"]]},{"id":"8dc76ee4573745ff","type":"debug","z":"faccc2278a3570b0","name":"pass if changed","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1100,"y":510,"wires":[]},{"id":"1c1defaa05c38bca","type":"debug","z":"faccc2278a3570b0","name":"rain expected?","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":510,"wires":[]},{"id":"1484cda8584ca9f3","type":"comment","z":"faccc2278a3570b0","name":"send OPEN command to awnings","info":"","x":1720,"y":450,"wires":[]},{"id":"cef4e89944793caa","type":"switch","z":"faccc2278a3570b0","name":"pushover: only trigger when true","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1370,"y":390,"wires":[["506542bac0d4b639"]]},{"id":"d55afbdadbc07c0c","type":"comment","z":"faccc2278a3570b0","name":"RAIN? send message","info":"","x":1647,"y":342,"wires":[]},{"id":"c431b68cb1040c2e","type":"debug","z":"faccc2278a3570b0","name":"filter rain data","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":400,"y":510,"wires":[]},{"id":"8e7b3990bfec0193","type":"link out","z":"faccc2278a3570b0","name":"OPEN AWNING","mode":"link","links":["b320318a8f7d3208"],"x":1555,"y":450,"wires":[]},{"id":"c95f394dd6a7191a","type":"comment","z":"faccc2278a3570b0","name":"Check for rain using the Buienradar Gadget","info":"","x":270,"y":250,"wires":[]},{"id":"44cf4fd0cdf922b4","type":"debug","z":"faccc2278a3570b0","name":"string array > number","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":510,"wires":[]},{"id":"49f08967972432a7","type":"ntc-node-red-pushover-keys","name":"Node-Red"}]

Many thanks to user Eicid from the Node-Red forum who helped me parse the data from Buienradar.

2 Likes

Download the Hubitat app