I see there are a few topics about pollen count but nothing really up to date. I did look at Pollen (again) but for the UK which uses Tado but I wasnt familiar with Tado and there were some comments to say it had stopped working for people.
Therefore, I set about finding a reliable and free API thats available in the UK which seemed to be a stumbling block for a few people previously.
I found https://www.tomorrow.io which has pretty extensive API at Weather API ☀ Get the Tomorrow.io Free Weather API Now
The free account is more than enough for me and allows 500 calls per day which for a pollen count I only intend to call every hour or so. There is a limit of 25 calls per hour which did casue my initial testing issues but now ive set everything up its working fine
After getting your API key from tomorrow, the resource URL ive used is
https://api.tomorrow.io/v4/timelines?location=<LATITUDE>,-<LONGATUDE>×teps=1d&units=metric&apikey=<API KEY>&fields=treeIndex,grassIndex,weedIndex
I have set up my sensors using the “1d” timestep which gives me daily readings and I am pulling in the treeIndex, grassIndex and weedIndex which gives me 3 types of pollen count. You may want to adjust this for your needs by reviewing the api docs.
Ive then set up a rest sensor to pull the infomration from the end point into 5 sensors (today, tomorrow, today+2 etc) with the grass pollen rating as the main sensor but also attributes for the weed and tree pollen.
rest:
- resource: !secret tomorrowio_pollen_api
scan_interval: 600
sensor:
### Pollen - Tree Index
- name: "Pollen - Grass Index - Day 0"
value_template: "{{ value_json.data.timelines[0].intervals[0]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[0].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
- name: "Pollen - Grass Index - Day 1"
value_template: "{{ value_json.data.timelines[0].intervals[1]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[1].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
- name: "Pollen - Grass Index - Day 2"
value_template: "{{ value_json.data.timelines[0].intervals[2]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[2].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
- name: "Pollen - Grass Index - Day 3"
value_template: "{{ value_json.data.timelines[0].intervals[3]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[3].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
- name: "Pollen - Grass Index - Day 4"
value_template: "{{ value_json.data.timelines[0].intervals[4]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[4].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
This gives me all the information I need in HA, but ive then created a template sensor for each the tree, grass and weed pollen counts with todays count as the main value and then attributes for today, tomorrow, today+2 etc as this just means it displays a bit better for me in my usecase,
template:
- sensor:
- name: Pollen - Grass
unique_id: sensor.pollen_grass
state: "{{ states('sensor.pollen_grass_index_day_0') }}"
icon: 'mdi:grass'
attributes:
Today: "{{ states('sensor.pollen_grass_index_day_0') }}"
Tomorrow: "{{ states('sensor.pollen_grass_index_day_1') }}"
Today + 2: "{{ states('sensor.pollen_grass_index_day_2') }}"
Today + 3: "{{ states('sensor.pollen_grass_index_day_3') }}"
Today + 4: "{{ states('sensor.pollen_grass_index_day_4') }}"
- name: Pollen - Tree
unique_id: sensor.pollen_tree
state: "{{ state_attr('sensor.pollen_grass_index_day_0', 'treeIndex') }}"
icon: 'mdi:tree'
attributes:
Today: "{{ state_attr('sensor.pollen_grass_index_day_0', 'treeIndex') }}"
Tomorrow: "{{ state_attr('sensor.pollen_grass_index_day_1', 'treeIndex') }}"
Today + 2: "{{ state_attr('sensor.pollen_grass_index_day_2', 'treeIndex') }}"
Today + 3: "{{ state_attr('sensor.pollen_grass_index_day_3', 'treeIndex') }}"
Today + 4: "{{ state_attr('sensor.pollen_grass_index_day_4', 'treeIndex') }}"
- name: Pollen - Weed
unique_id: sensor.pollen_weed
state: "{{ state_attr('sensor.pollen_grass_index_day_0', 'weedIndex') }}"
icon: 'mdi:spa'
attributes:
Today: "{{ state_attr('sensor.pollen_grass_index_day_0', 'weedIndex') }}"
Tomorrow: "{{ state_attr('sensor.pollen_grass_index_day_1', 'weedIndex') }}"
Today + 2: "{{ state_attr('sensor.pollen_grass_index_day_2', 'weedIndex') }}"
Today + 3: "{{ state_attr('sensor.pollen_grass_index_day_3', 'weedIndex') }}"
Today + 4: "{{ state_attr('sensor.pollen_grass_index_day_4', 'weedIndex') }}"
Ive then displayed this using a simple glance card using css mod to change the colours f my logos based on the height of the pollen count.
And clicking into a type of pollen shows me the forecast
I hope this can be helpful for others as we enter the hayfever season!
As mentioned at the start, i believe the tomorrow.io API covers the whole world so anyone should be able to use this implementation.