Skip to content

jp2creation/JP2-Air-Quality-Card


JP2 Air Quality Card

A Home Assistant Lovelace card with a clean dashboard look to display air quality & comfort at a glance
(CO₂, VOC, radon, CO, CH₂O, pressure, temperature, humidity… from airthings, netatmo, Xiaomi and others devices ) with a colored gauge, a status label, an optional AQI summary, and an integrated history graph.

Note

This module supports values from any Home Assistant–compatible sensor, so you can display and interpret indoor air quality from all your entities in one unified card.

airthings xiaomi netatmo sonoff tuya ...



Installation

Option A — HACS (Custom repository)

JP2 AAir Quality Card is available in HACS (Home Assistant Community Store).

Use this link to directly go to the repository in HACS

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.


Option B — Manual

  1. Copy jp2-air-quality.js to:
    • /config/www/ (Lovelace path is /local/)
  2. Add Lovelace resource:
    • Settings → Dashboards → Resources → Add
    • URL: /local/jp2-air-quality.js
    • Type: Module
  3. Hard refresh the browser

Important

The main file must stay named exactly jp2-air-quality.js.




Quick start

type: custom:jp2-air-quality
title: Air quality
entities:
  radon: sensor.radon_bq_m3
  co2: sensor.co2_ppm
  voc: sensor.voc_ppb
  pressure: sensor.pressure_hpa
  temperature: sensor.temperature_salon
  humidity: sensor.humidity_salon


JP2 Air Quality Card previewJP2 Air Quality Card preview


Examples

Minimal card (only CO₂)
type: custom:jp2-air-quality
title: Living room
entities:
  co2: sensor.living_room_co2

Graph enabled (24h)
CO2 card preview
type: custom:jp2-air-quality
title: Living room
show_graph: true
graph_hours: 24
entities:
  co2: sensor.living_room_co2
  temperature: sensor.living_room_temperature
  humidity: sensor.living_room_humidity

AQI summary (with thresholds)
type: custom:jp2-air-quality
title: Living room

aqi:
  enabled: true
  hide_sensors: false
  sensors:
    - entity: sensor.living_room_co2
      label: CO2
      unit: ppm
      good: 800
      medium: 1200
    - entity: sensor.living_room_voc
      label: VOC
      unit: ppb
      good: 150
      medium: 300

entities:
  co2: sensor.living_room_co2
  voc: sensor.living_room_voc
  temperature: sensor.living_room_temperature
  humidity: sensor.living_room_humidity

AQI mode — hide the sensor list
type: custom:jp2-air-quality
title: Living room

aqi:
  enabled: true
  hide_sensors: true
  sensors:
    - entity: sensor.living_room_co2
      label: CO2
      unit: ppm
      good: 800
      medium: 1200
    - entity: sensor.living_room_voc
      label: VOC
      unit: ppb
      good: 150
      medium: 300

entities:
  co2: sensor.living_room_co2
  voc: sensor.living_room_voc

AQI mode — horizontal layout + icons only

[!TIP]
This mode is perfect for a compact “summary row”.

type: custom:jp2-air-quality
title: Living room

aqi:
  enabled: true
  layout: horizontal
  icons_only: true
  sensors:
    - entity: sensor.living_room_co2
      label: CO2
      unit: ppm
      good: 800
      medium: 1200
    - entity: sensor.living_room_voc
      label: VOC
      unit: ppb
      good: 150
      medium: 300
    - entity: sensor.living_room_radon
      label: Radon
      unit: Bq/m³
      good: 100
      medium: 300

entities:
  co2: sensor.living_room_co2
  voc: sensor.living_room_voc
  radon: sensor.living_room_radon

AQI title — add an image and/or an icon on the left
type: custom:jp2-air-quality
title: Living room

aqi:
  enabled: true

  # Left of “AQI”
  title_icon: mdi:air-filter
  title_image: /local/icons/air-quality.png

  sensors:
    - entity: sensor.living_room_co2
      label: CO2
      unit: ppm
      good: 800
      medium: 1200

entities:
  co2: sensor.living_room_co2

Icon styling (no background + no ring)
type: custom:jp2-air-quality
title: Living room

icon:
  size: 44
  show_background: false
  show_circle: false

entities:
  co2: sensor.living_room_co2
  temperature: sensor.living_room_temperature
  humidity: sensor.living_room_humidity



Options

General

Name Type Default Description
title string Card title
entities object Sensors mapping: co2, voc, radon, pressure, temperature, humidity

Graph

Name Type Default Description
show_graph boolean false Enable built-in history graph
graph_hours number 24 History window in hours

Icon

Name Type Default Description
icon.size number 44 Icon size (px)
icon.show_background boolean true Show/hide icon background
icon.show_circle boolean true Show/hide icon ring

AQI (Air Quality Index)

Name Type Default Description
aqi.enabled boolean false Enable AQI summary mode
aqi.hide_sensors boolean false Hide the sensor list in AQI mode
aqi.layout string vertical AQI layout (vertical / horizontal)
aqi.icons_only boolean false In horizontal layout: only show icons (hide the rest)
aqi.title_icon string Optional left icon (e.g. mdi:air-filter)
aqi.title_image string Optional left image (e.g. /local/...png)
aqi.sensors array [] AQI sensors list with thresholds

aqi.sensors[] item

Field Type Required Description
entity string HA entity (ex: sensor.co2_ppm)
label string Display name
unit string Display unit (ppm/ppb/…)
good number “Good” threshold
medium number “Medium” threshold (above = “Bad”)

Important

If you previously used the iqa: key, update it to aqi:.




Visual editor

JP2 Air Quality visual editorJP2 Air Quality visual editor


V2+ includes a full redesign of the visual editor:

  • smoother UI / fewer freezes
  • clearer settings sections
  • more stable behavior when enabling AQI and/or Graph
  • cleaner internal structure for easier maintenance



Troubleshooting

Card not showing / “Custom element doesn’t exist”

  • Check the resource path (/local/... or /hacsfiles/...)
  • Ensure the resource type is Module
  • Hard refresh the browser

Old version still loaded

  • Clear browser cache
  • Or use a cache buster: /local/jp2-air-quality.js?v=2

Graph is empty

  • Recorder/history must be enabled
  • The entity state must be numeric

Freeze when enabling AQI

  • Update to the latest version (includes stability improvements and visual editor updates)



Development

Copy jp2-air-quality.js into /config/www/
Add resource: /local/jp2-air-quality.js?v=dev
Hard refresh browser after each change.

Tip: keeping ?v=dev helps bypass cache while iterating.




Contributing

Please open an Issue with:

  • Home Assistant version
  • YAML config (remove sensitive info)
  • Console logs (F12)

PR workflow:

  1. Fork
  2. Create a branch: feature/my-feature
  3. Clean commits
  4. Pull Request



Changelog

See GitHub releases: Releases




License

MIT — see LICENSE.




Support

If this project helps you, you can support it here: Buy me a coffee



About

A sleek Home Assistant Lovelace card to monitor indoor air quality (AQI) with a visual editor, multi-sensor tiles, and per-sensor overrides.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors