Ok, are you confident in solving issues? This one will be tough!.
I made a script, in Python, it is giving a json that contains info from kleenex.
kleenex.py https://www.kleenex.nl/pollenradar?city=Maastricht
result:
{
"Gras": 0
"Bomen": 11
"Onkruid": 0
}
The script is the following
#!/usr/local/bin/python3.10
from requests_html import HTMLSession
import sys
url = sys.argv[1]
session = HTMLSession()
r = session.get(url)
r.html.render(sleep = 2, timeout = 20)
levels = r.html.find('.ppm-level')
print("{")
print("\"Gras\": " + levels[0].text.split()[0])
print("\"Bomen\": " + levels[1].text.split()[0])
print("\"Onkruid\": " + levels[2].text.split()[0])
print("}")
But for this script to work, it will require requests-html
to be installed in your environment
python3.10 -m pip install requests-html
If you’re not using an x86-64 machine, chromium installation will fail.
To solve that, you have to follow what is written on this page:
If you managed to go through all those difficulties, it should work and you can run it as a command line in HA.
Good luck!
EDIT - CAVEAT
This is very dependant of the kleenex website.
It is assuming that you’ll always get 3 values, for gras, bomen and onkruid, in that order, with that specific ‘ppm-level’ class.
If the page change, everything will collapse!
EDIT2 Then, you can do gauges with the levels from the kleenex website:
Risiconiveau |
Boom |
Gras |
Onkruid |
Laag |
0-95 |
0-29 |
0-20 |
Gemiddeld |
96-207 |
30-60 |
21-77 |
Hoog |
208-703 |
61-341 |
78-266 |
Zeer hoog |
704+ |
342+ |
267+ |