Pollen/Allergy Sensor

See above for the table for the levels.
I’ve noticed recently that, for me in the UK, that it seems to be wrong, maybe its a UK thing.
Today it is showing low(1) but every other website shows it is high.
I’ve just moved onto using scrape to get the levels from a website, seems to be OK so far.

Yeah that’s why I didn’t trust the table! :smiley:
Would you mind sharing your scrape settings?
Thanks!!

Sure, you’ll need to visit weather.com and get the url for your location and replace in all the sensors
I’m no expert (took a lot of trial and error!) so might be an easier way to do it

- platform: scrape
  resource: https://weather.com/en-GB/forecast/allergy/l/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  select: "._-_-components-src-organism-PollenBreakdown-PollenBreakdown--body--OrmOR > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > ul:nth-of-type(1) > li:nth-of-type(1) > strong:nth-of-type(1)"
  name: Pollen Today Tree
  scan_interval: 86400

- platform: scrape
  resource: https://weather.com/en-GB/forecast/allergy/l/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  select: "._-_-components-src-organism-PollenBreakdown-PollenBreakdown--body--OrmOR > div:nth-of-type(2) > div:nth-of-type(1) > div:nth-of-type(2) > ul:nth-of-type(1) > li:nth-of-type(1) > strong:nth-of-type(1)"
  name: Pollen Today Grass
  scan_interval: 86400

- platform: scrape
  resource: https://weather.com/en-GB/forecast/allergy/l/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  select: "._-_-components-src-organism-PollenBreakdown-PollenBreakdown--body--OrmOR > div:nth-of-type(3) > div:nth-of-type(1) > div:nth-of-type(2) > ul:nth-of-type(1) > li:nth-of-type(1) > strong:nth-of-type(1)"
  name: Pollen Today Weed
  scan_interval: 86400

- platform: scrape
  resource: https://weather.com/en-GB/forecast/allergy/l/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  select: "._-_-components-src-organism-PollenBreakdown-PollenBreakdown--body--OrmOR > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > ul:nth-of-type(1) > li:nth-of-type(2) > strong:nth-of-type(1)"
  name: Pollen Tomorrow Tree
  scan_interval: 86400

- platform: scrape
  resource: https://weather.com/en-GB/forecast/allergy/l/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  select: "._-_-components-src-organism-PollenBreakdown-PollenBreakdown--body--OrmOR > div:nth-of-type(2) > div:nth-of-type(1) > div:nth-of-type(2) > ul:nth-of-type(1) > li:nth-of-type(2) > strong:nth-of-type(1)"
  name: Pollen Tomorrow Grass
  scan_interval: 86400

- platform: scrape
  resource: https://weather.com/en-GB/forecast/allergy/l/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  select: "._-_-components-src-organism-PollenBreakdown-PollenBreakdown--body--OrmOR > div:nth-of-type(3) > div:nth-of-type(1) > div:nth-of-type(2) > ul:nth-of-type(1) > li:nth-of-type(2) > strong:nth-of-type(1)"
  name: Pollen Tomorrow Weed
  scan_interval: 86400
7 Likes

Climacell pollen sensors seem to have stopped working for me in the last few days (since I updated hassio and the custom component.) Do any of you have it working still?

this works thankyou!

I’ve just switched to this, no more scraping needed and I just setup a tado account with no devices.

1 Like

Got lots of great ideas from this thread, and I’ve been using the scraper that @Holdestmade put up there.

I’ve set up a RESTful sensor to pull the data from The Weather Network (Canadian weather site).

I’ve used the following link, with the code at the end being the location code for my area: https://www.theweathernetwork.com/api/data/XXXXXXXX

And this is the code I added to my configuration.yaml:

sensor:
  - platform: rest
    resource: https://www.theweathernetwork.com/api/data/XXXXXXXX
    name: Pollen Level
    value_template: '{{ value_json.obs.pollen_index }}'

I’m going to expand this to pull a few other data points from the data, works very well.

1 Like

Hi,
I like what you have done. Is it possible to get multiple data values, not just pollen, with one rest call?
thx

There’s tons of data I can see that you could scrape out of the data file, I just opened the linked data in NotePad++ to find the values I was looking for.

I don’t know if you can do it in one single rest call, that’s beyond what I’ve tried. So far I have a bunch of rest calls for data points.

Yes, thanks. I too used Notepad++ to see the data and there is a lot of good info. I was hoping to scrape more than one field with just the one call. Indeed, you can with some examples here.
https://www.home-assistant.io/integrations/rest/

I’d love some help simplifying my RESTful call, I’m using a bunch like this:

  # weather network environment data
sensor:
  - platform: rest
    resource: https://www.theweathernetwork.com/api/data/XXXXXXXX
    name: Pollen Level
    value_template: '{{ value_json.obs.pollen_index }}'

  - platform: rest
    resource: https://www.theweathernetwork.com/api/data/XXXXXXXX
    name: UV Index
    value_template: '{{ value_json.obs.uv_label }}'

This is what I’m trying, but I can’t seem to get it to work.

  - platform: rest
    name: Weather Network Data
    resource: https://www.theweathernetwork.com/api/data/XXXXXXXX
    json_attributes:
      - pollen_index
      - uv_label
    value_template: '{{ value_json.obs }}'
  - platform: template
    sensors:
      pollen:
        value_template: '{{ states.sensor.weather_network_data.attributes["pollen_index"] }}'
        friendly_name: 'Pollen'
      uv_level:
        value_template: '{{ states.sensor.weather_network_data.attributes["uv_label"] }}'
        friendly_name: 'UV Level'

Obviously this should be done with one REST call, but I cannot get it to work. Help please! There’s about a half dozen datapoints I want to pull this way :slight_smile:

This is what I have done and it works well. Just add the datapoints that you need.

  - platform: rest
    resource: https://www.theweathernetwork.com/api/data/caon9999
    name: weather_network
    json_attributes:
      - obs
    value_template: 'OK'      
    scan_interval:
      minutes: 160

  - platform: template
    sensors:
      weather_network_pollen_index:
        value_template: '{{ states.sensor.weather_network.attributes["obs"]["pollen_index"] }}'
      weather_network_pollen_name:
        value_template: '{{ states.sensor.weather_network.attributes["obs"]["pollen_name"] }}'
      weather_network_temperature:
        value_template: '{{ states.sensor.weather_network.attributes["obs"]["t"] }}'
        device_class: temperature
        unit_of_measurement: '°C'

3 Likes

Thanks @fantangelo this is great!

This is what I ended up with, working perfectly.

# weather network environment data
sensor:
  - platform: rest
    resource: https://www.theweathernetwork.com/api/data/XXXXXXXX
    name: weather_network
    json_attributes:
      - obs
      - swo
    value_template: 'OK'
    scan_interval:
      minutes: 160

  - platform: template
    sensors:
      weather_network_pollen_index:
        value_template: '{{ states.sensor.weather_network.attributes["obs"]["pollen_index"] }}'
        friendly_name: 'Pollen Index'
      weather_network_pollen_name:
        value_template: '{{ states.sensor.weather_network.attributes["obs"]["pollen_name"] }}'
        friendly_name: 'Pollen Risk Type'
      weather_network_uv_index:
        value_template: '{{ states.sensor.weather_network.attributes["obs"]["uv_label"] }}'
        friendly_name: 'UV Index'
      weather_network_air_quality:
        value_template: '{{ states.sensor.weather_network.attributes["obs"]["aq_level"] }}'
        friendly_name: 'Air Quality'
      weather_network_temperature:
        value_template: '{{ states.sensor.weather_network.attributes["obs"]["t"] }}'
        friendly_name: 'Temperature (Weather Network)'
        device_class: temperature
        unit_of_measurement: '°C'
      weather_network_swo_level:
        value_template: '{{ states.sensor.weather_network.attributes["swo"]["swo_level"] }}'
        friendly_name: 'Severe Weather Risk Level'
      weather_network_swo_type:
        value_template: '{{ states.sensor.weather_network.attributes["swo"]["swo_type"] }}'
        friendly_name: 'Severe Weather Risk Type'
4 Likes

In hopes that this thread isn’t completely dead, I am trying to use your solution here, and it seems that the api is a paid for service; I cannot seem to access it unless I use your resource name; which obviously will not work for me (your location is hardcoded).

Are you paying for this (TheWeatherNetwork API); or is there a free access that I am missing? I have also tried using the Pollen.com REST API; and these are giving me a 405 error:

" 405 - HTTP verb used to access this page is not allowed"

https://www.pollen.com/api/forecast/current/pollen/ZIPCODE

(Changing ZIPCODE with my real zip)

Are you paying for this (TheWeatherNetwork API); or is there a free access that I am missing? I have also tried using the Pollen.com REST API; and these are giving me a 405 error:

Nope, not paid. To get your location code for TheWeatherNetwork, I found that if you just go to your city, then hover over a link to see. For instance, if I live in Toronto, I go to Toronto’s page then hover over the air quality link I can see it links to a page ending in caon0696

Plug that in where I put the XXXXXs and it will pull data.

3 Likes

Well I’ll be damned…

Yeah, that worked for me; and I get accurate data from that. Thank you @rexbot!

1 Like

Not exactly answers your request, but you could also try https://airly.org/map/en/, depending on your location. Airly has mobile app and HA integration with the Particulate Matter sensor.

I am looking for a sensor for Austria, any ideas?

See this link:

and use https://www.theweathernetwork.com/api/data/auxx0025 (for Vienna)

Or try this link:

with Informationen zu Pollenzahl und Allergien für Wien - The Weather Channel | weather.com (also Vienna)

2nd method not working for me. Got Unknown as a result. Maybe the web has changed recently and the scrape code is not working anymore?