Skip to content

eretl/ha-chmi-pollen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

CHMI Pylový semafor — Home Assistant Integration

A custom Home Assistant integration that reads the current pollen threat level for any location in the Czech Republic directly from the ČHMÚ Pylový semafor map image.


How it works

During setup, the live ČHMÚ pollen map is displayed in your browser. You click your location on the map and the integration samples the colour at that exact pixel every 12 hours, converting it to a numeric threat level. The national forecast table is used as a fallback if the image is unavailable.

pyl_M1.png (ČHMÚ map image)
        │
        ▼
  pixel colour at your chosen point
        │
        ▼
  HSV hue → pollen level 0–4
        │
        ▼
  sensor.pollen_level

Pollen levels

Value Label Czech
0 negligible zanedbatelná
1 low mírná
2 moderate střední
3 high vysoká
4 extreme mimořádná

0 is the default when pollen season hasn't started or data is unavailable.


Requirements

  • Home Assistant 2023.6 or newer
  • Python packages (installed automatically by HA):
    • beautifulsoup4 >= 4.12.0
    • Pillow >= 10.0.0

Installation

HACS (recommended)

  1. Open HACS → Integrations → ⋮ → Custom repositories
  2. Add this repository URL, category Integration
  3. Install CHMI Pylový semafor
  4. Restart Home Assistant

Manual

  1. Copy the custom_components/chmi_pollen/ folder into your config/custom_components/ directory
  2. Restart Home Assistant

Setup

  1. Go to Settings → Devices & Services → Add Integration
  2. Search for CHMI Pollen
  3. Enter a name for this sensor (e.g. Plzeň home)
  4. A browser tab opens showing the live ČHMÚ pollen map — click your location
  5. Press Confirm location — the tab closes and the sensor is created

You can add multiple sensors for different locations by repeating the setup.


Sensor

Entity: sensor.pollen_level (or sensor.<location_name>_pollen_level)

State: integer 04

Attributes

Attribute Description
level_label Human-readable level (negligible, low, …)
forecast 4-day forecast array from the national table [{day, date, level, label}]
dates List of forecast dates
source map or table — which data source was used
map_level Raw level from image colour sampling
table_level Raw level from the forecast table
map_x_frac Horizontal position on the map image (0–1)
map_y_frac Vertical position on the map image (0–1)
location The name you gave this sensor
source_url Link to the ČHMÚ page

Automation examples

Notify when pollen is high

alias: High pollen alert
trigger:
  - platform: numeric_state
    entity_id: sensor.pollen_level
    above: 2
action:
  - service: notify.mobile_app_your_phone
    data:
      title: "🌿 High pollen warning"
      message: >
        Pollen level is {{ states('sensor.pollen_level') }}
        ({{ state_attr('sensor.pollen_level', 'level_label') }}) today.

Close windows automatically

alias: Close windows on high pollen
trigger:
  - platform: numeric_state
    entity_id: sensor.pollen_level
    above: 2
action:
  - service: cover.close_cover
    target:
      entity_id: cover.living_room_window

Dashboard card

type: entity
entity: sensor.pollen_level
name: Pollen today
icon: mdi:flower-pollen

Data sources

  • Map image: https://intranet.chmi.cz/files/portal/docs/meteo/ok/pyly/pyl_M1.png
    Updated daily by ČHMÚ. The integration proxies this image through HA's HTTP layer so the browser canvas can read pixel colours without cross-origin restrictions.

  • Forecast table: https://intranet.chmi.cz/files/portal/docs/meteo/ok/pyly/pylovy_semafor.html
    Used to populate the 4-day forecast attribute and as fallback for the current level.

Note: Both URLs are on the intranet.chmi.cz subdomain but are publicly accessible. If they ever return 403, the public mirror at portal.chmi.cz uses the same path.


Troubleshooting

Sensor always shows 0
The clicked point may have landed on the map background (white area outside Czech Republic borders). Delete the integration and re-add it, clicking a point clearly inside the country.

source attribute shows table
The map image could not be fetched. Check HA logs for CHMI pollen map fetch failed. The national table value is used instead.

Setup tab shows 404
The HTTP views were not registered. Make sure you have no stale chmi_pollen entries from a previous install. Restart HA after copying the files and try again.

Setup tab shows 401
All picker endpoints are unauthenticated by design — the flow_id UUID in the URL is the only credential needed. If you see 401, an older cached version of the integration may still be loaded. Restart HA.


About

Get pollen data from chmi map to home assistant

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages