Skip to content

v0.1.1 — AQI category & color attributes (US/EU/UK schemes)

Latest

Choose a tag to compare

@jpettitt jpettitt released this 18 May 18:15
a8d81ba

Minor release: AQI category + colour as entity attributes.

Every AQI entity now carries two extra attributes that any
template-aware dashboard card can read — making "icon turns green
when air is clean, red when it's not" a one-line card config.

What's new

  • category — a stable snake-case label for the current AQI
    band (good, moderate, unhealthy_for_sensitive_groups, …).
  • category_color — the official hex colour for that band.
  • aqi_color_scheme option in the options flow with three
    country presets:
    • US EPA (default) — AirNow 2024-revised PM2.5 palette
    • EU EAQI — European Environment Agency bands & colours
    • UK DAQI — Defra Daily Air Quality Index, 10 numeric bands

The scheme controls the category and category_color attributes
only — the AQI integer state stays on the post-2024 US-EPA
breakpoint table for consistency across schemes.

Example: Mushroom card

type: custom:mushroom-template-card
entity: sensor.outdoor_0119_aqi_epa
icon: mdi:weather-hazy
icon_color: |
  {{ state_attr('sensor.outdoor_0119_aqi_epa', 'category_color') }}
primary: |
  {{ states('sensor.outdoor_0119_aqi_epa') }} AQI
secondary: |
  {{ state_attr('sensor.outdoor_0119_aqi_epa', 'category')
       | replace('_', ' ') | title }}

See README → Dashboard examples
for apexcharts-card and button-card snippets.

Internals worth knowing

  • The category + colour both derive from the same intermediate
    µg/m³ value the AQI state is computed from, so colour and number
    can't drift. Raw entities use ATM; EPA/AQandU/LRAPA use their
    corrected value.
  • Adding more national schemes later is a tuple literal in
    aqi.py — the entity layer is scheme-agnostic.

Upgrading from v0.1.0

No breaking changes. Existing config entries keep their settings
and pick up the default US EPA scheme automatically. New options
flow field appears the next time you open Configure.

Full changelog: v0.1.0...v0.1.1