Pollen/Allergy Sensor

i love having this – although i’m convinced knowing the pollen level everyday makes my allergies psychosomatically worse. :slight_smile:

small feature request if you don’t mind: the pollen sensor reports data for the primary allergen, while the website reports the top 3. is it possible to get the top 3 built-in and not just the primary? for what i want, i’m currently using the rest sensor below. thanks!!

- platform: rest
  name: 'allergens'
  resource: !secret pollen_url
  value_template: >-
    {% if value_json.Location.periods[1].Triggers[0] %}
    {{ value_json.Location.periods[1].Triggers[0].Name }}
    {% else %}
    -
    {% endif %} 
    {% if value_json.Location.periods[1].Triggers[1] %}
    , {{ value_json.Location.periods[1].Triggers[1].Name }}
    {% else %}
    
    {% endif %} 
    {% if value_json.Location.periods[1].Triggers[2] %}
    , {{ value_json.Location.periods[1].Triggers[2].Name }}
    {% else %}
    
    {% endif %} 
  scan_interval: 21600
  headers:
    Referer: "https://www.pollen.com"

Shouldn’t be a problem! I’ll get on it.

1 Like

We’re good to go! PR submitted here: https://github.com/home-assistant/home-assistant/pull/14018

This will produce attributes (for the “Allergy Index: Today” sensor) that look like this:

If you’re anxious to add this before the next version goes out, you can always add the PR as a custom component.

1 Like

excellent! i’ll take a look

Took a look at Air Matters. It’s possible to reverse engineer the API from the mobile app, but one main issue prevent me from proceeding: it looks like each request is signed with some sort of authorization header (to validate request authenticity, I assume).

I’m reaching out to their business development folks to see if they’d be willing to help. Stay tuned.

1 Like

FYI, haven’t heard back from the Air Matters people and nothing in the unpublished API, so that one appears to be off the table for now. Sorry!

While there are still no components for those suffering in the UK, I’ve hacked myself following REST sensor:

- platform: rest
  name: "Pollen count"
  resource: "https://socialpollencount.co.uk/api/forecast?location=[YOUR_LAT, YOUR_LON]"
  value_template: >
    {% for day in value_json.forecast -%}
      {%- if now().date() | string() in day.date %}
        {{ day.pollen_count }}
      {% endif -%}
    {%- endfor %}
4 Likes

And here is one for next day (forecast):

- platform: rest
  name: "Pollen count tomorrow"
  resource: "https://socialpollencount.co.uk/api/forecast?location=[YOUR_LAT, YOUR_LON]"
  value_template: >
    {% set tomorrow = (as_timestamp(now()) + 86400) | timestamp_custom("%Y-%m-%d") | string %}
    {% for day in value_json.forecast -%}
      {%- if tomorrow in day.date %}
        {{ day.pollen_count }}
      {% endif -%}
    {%- endfor %}
4 Likes

I don’t seem to be getting any response from this. When testing using APItester.com i get this as a response.
{“status_code”:“403 Forbidden”,“date”:“2018-06-25T15:39:39+00:00”,“message”:“Could not parse location”}

I’m using my LAT and LON from Wunderground i.e. 51.30, -0.141
this is just a field so u can;t spy on me :smile:

Hmm if i use that other persons LAT and LON it works
https://community.home-assistant.io/t/pollen-count/21283

I suspect they don’t have anything near my location, even removing a few digits or putting the word london does work.

Any one know how to pull from the website what it’s using to give the details when i got to the page directly ?

@cooljimy84

Try this one, it needs the [ ] brackets (the %5B and %5D encoding):

https://socialpollencount.co.uk/api/forecast?location=[51.30,-0.141]

for swiss people, I use the following webpage : http://teletext.api.swisstxt.ch/mobile/pics/large/RTSUn_518-00.gif

and do a little script with tesseract.

1 Like

Would this be useful for Europe?

http://www.regional.atmosphere.copernicus.eu/

const API_KEY = 'CSIBZ-4LKWV-HNIPZ-UYVZG-BYG6O-PSBMP'

Where did he get that from? :laughing:

1 Like

I GOT IT. Instead of reverse engineering the Air Matters iOS app, I went after the web app – I think I’ve got what I need. Will start working on a library for the integration ASAP.

4 Likes

Not sure what i was doing wrong, but that worked fine ?!?!?

Awesome.

Anyone else having issues with the pollen.com sensors?

me too… getting

2018-07-05 08:58:56 ERROR (SyncWorker_3) [homeassistant.components.sensor.pollen] An error occurred while retrieving data
2018-07-05 08:58:57 ERROR (SyncWorker_1) [homeassistant.components.sensor.pollen] Pollen.com API didn't return any data```
1 Like

The website is down. You can check the same by visiting the website. Current Pollen Allergy Forecast for Austin, TX (73344) | Pollen.com<ZIP_CODE>