Skip to content
Foxi352Public

About

Home assistant custom integration for pollen.lu data

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

Pollen.lu

This component adds actual pollen count from pollen.lu mobile app to Home Assistant.

A current count is provided every 3 hours for the following grass and tree pollen:

Latin English Deutsch Français
Rumex Sorrel Ampfer Oseille
Artemisia Mugwort Beifuß Armoise
Betula Birch Birke Bouleau
Fagus Beech Buche Hêtre
Quercus Oak Eiche Chêne
Alnus Alder Erle Aulne
Fraxinus Ash Esche Frêne
Chenopodium Goosefoot Gänsefuß Chénopode
Poacea Grasses Gräser Graminées
Corylus Hazel Shrub Haselnussstrauch Noisetier
Plantago Plantain Wegerich Plantain

This component fetches data every hour from the pollen.lu API. The remote data is, as of this writing, updated every 3 hours.

If you like this component, please give it a star on github.

Installation

Requires Home Assistant 2025.12.0 or newer. Compatibility regression tests pass against Home Assistant 2025.12.0 and 2026.10.0.

  1. Ensure that HACS is installed.

  2. Install Pollen.lu integration via HACS.

  3. Add Pollen.lu integration to Home Assistant:

In case you would like to install manually:

  1. Copy the folder custom_components/pollen_lu to custom_components in your Home Assistant config folder.

  2. Add Pollen.lu integration to Home Assistant:

Configuration

After adding the integration, you can configure the polling interval via the integration options.

The interval must be a positive whole number of minutes. Invalid intervals saved by an older version temporarily fall back to 60 minutes until corrected in the options dialog.

Only one integration instance can be added, since every instance would read the same pollen data. Existing sensor unique IDs are preserved.

Sensors

This integration provides one sensor per pollen type. The sensor is named according to the pollen type (latin name).

Sensor State

The sensor state is the latest pollen count, rounded to a whole number. An explicit undetected level reports zero. Missing or invalid measurements report unknown; inactive or missing pollen records, and failed API refreshes, make the affected sensors unavailable.

Sensor Attributes

Each sensor provides the following attributes (not including default attributes):

Attribute Example Description
level high Actual level (undetected, low, medium, high)
last_update 2024-03-29 12:00:12 When the pollen was last counted
last_poll 2024-07-03 16:10:29 When pollen data was last fetched successfully
description Die Erle gehört ... A localized description of the plant / tree
moderate_threshold 11 Threshold from which the concentration is considered moderate
high_threshold 51 Threshold from which the concentration is considered high
entity_picture https://pollen-api.chl.lu/pictures/aulne.svg URL
friendly_name Pollen Erle Localized friendly name

The friendly name and the description are both localized to the Home Assistant system language. Available are english, german and french.

If a translation is missing, its key is used as a fallback. Missing optional descriptions, pictures, and thresholds are omitted rather than replaced with invented values.

last_poll records a successful API fetch; last_update records the measurement date supplied by the API. A successful fetch does not necessarily mean a new measurement is available. Both remain unchanged when a fetch fails.

The former next_poll attribute has been removed because manual refreshes and failed requests made its estimated time misleading. Update any dashboards or automations that reference it.

API outages

Each request has a 30-second total timeout and a 10-second connection timeout. Home Assistant logs the initial polling failure, suppresses repeated errors during the same outage, and logs recovery at INFO level. Expected failures include timeouts, connection errors, HTTP errors, and malformed responses. Unexpected errors retain their traceback for troubleshooting.

During an outage, sensors become unavailable while the integration keeps the last successfully fetched measurements and timestamp. It retries at the configured polling interval. When an HTTP 429 or 5xx response includes a valid Retry-After header, Home Assistant delays the next scheduled poll by the longer of the requested delay and the configured interval. Both seconds and HTTP dates are supported. Missing, invalid, zero, or past-date headers keep normal polling; successful requests resume the configured interval.

Initial setup failures use Home Assistant's automatic setup retry; the coordinator's retry delay applies only after setup has succeeded. Manual refreshes explicitly override the scheduled wait: the force-poll action makes one bounded fetch attempt immediately and reports an error if it fails. A successful manual refresh also restores normal polling.

Actions

pollen_lu.force_poll

This action forces the integration to poll the Pollen.lu API immediately.

It refreshes all currently loaded Pollen.lu instances and updates their sensors. Response data is optional: automations can call the action without a response_variable, or capture {"success": true} when needed. If no instance is loaded or a refresh fails, the action reports an error.

Example usage:

  1. Go to Developer Tools -> Actions.
  2. Select pollen_lu.force_poll from the dropdown.
  3. Click "Call Action" to force a poll.

Example Automation

You can create an automation to run the force_poll action, for example, every day at a specific time:

automation:
  - alias: Daily Force Poll Pollen Data
    trigger:
      platform: time
      at: '08:00:00'
    action:
      action: pollen_lu.force_poll

Development checks

The compatibility regression tests use Home Assistant 2026.10.0's flow, service, and coordinator APIs with mocked network requests and platform loading. Run them in a Python 3.14 virtual environment:

python -m pip install -r requirements-test.txt
python -m pytest -q tests

To check the minimum version, use a separate Python 3.13 virtual environment:

python -m pip install 'homeassistant==2025.12.0' 'pycares<5' 'pytest==9.1.1' 'pytest-asyncio==1.4.0'
python -m pytest -q tests

The DNS dependency constraint keeps that older Home Assistant release's aiodns dependency compatible in a newly created test environment.

About

Home assistant custom integration for pollen.lu data

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages