Pollen/Allergy Sensor

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 https://weather.com/de-AT/forecast/allergy/l/b1c12cb5f559c61ffb70bb86034f904e94f0bf0817f3adc85177b27014c8fbe0 (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?

Have you tried AccuWeather integration ? That has pollen sensors for me (UK)

Sadly my accuweather integration has no pollen sensor :frowning_face:

My pollen entities were hidden after installation (along with 70+ others) and had to enable them ?

Just to report back…

I inspected the weather network data in my area (usca1019), and sadly pollen info are missing.

As for pollen.com, it’s now given 403 (permission denied).

Anyone able to get something work for US?

This is what I am looking for, excuse me if the question has been asked, is there a way to get the location code? Thanks!

Actually, it is not that hard, view source page of the weather network, search for ““placecode”:” that will be the city code.:slight_smile:

1 Like

The new ClimaCell integration has today’s Tree/Grass/Weed pollen count included.