Hi GertJan,
Thanks for the heads-up, I did notice, but didn’t connect the dots jet.
The gpsapi changed and no longer accepts extra parameters. The original request used &c= […] str(random.randint(0,999999999999999), to disable caching. It’s not pretty, but it works.
I thought the solution was to change that: change the command_line sensor, change the “command” to:
python3 -c "import requests; import json; import random; dataRequest = requests.get('https://gpsgadget.buienradar.nl/data/raintext?lat=<lat-2-decimals>&lon=<lon-2-decimals>',headers={'Cache-Control':'no-cache'}).text; dataRequest = dataRequest.replace('\r\n',' '); data = '{\"data\":\"'+dataRequest+'\"}'; print(data);"
The code above sends a header with the request disabling caching, arguably prettier . Now the sensor works fine.
However, it’s still not giving me updated data. A normal browser request delivers the same data. I think they are downsizing this api.
So I went looking around for a different data source. And tada: https://graphdata.buienradar.nl/2.0/forecast. Still data blocks of 5 minutes.
I’m just testing this, when the sensor works without error for a few days, I will write an update.
Kind regards,
– Ingrid