Air Purifier card for Home Assistant Lovelace UI
By default, the Home Assistant does not provide any card for controlling air purifiers. This card displays the state and allows to control your air purifier.
💡 Tip: If you like this project and want to get some stickers and postcards, consider becoming a patron:
or just buy me a cup of ☕️ or 🥤:
This card is available in HACS (Home Assistant Community Store).
Just search for Purifier Card
in the plugins tab.
- Download
purifier-card.js
file from the latest-release. - Put
purifier-card.js
file into yourconfig/www
folder. - Add a reference to
purifier-card.js
in Lovelace. There's two way to do that:- Using UI: Configuration → Lovelace Dashboards → Resources → Click Plus button → Set Url as
/local/purifier-card.js
→ Set Resource type asJavaScript Module
. - Using YAML: Add the following code to
lovelace
section.resources: - url: /local/purifier-card.js type: module
- Using UI: Configuration → Lovelace Dashboards → Resources → Click Plus button → Set Url as
- Add
custom:purifier-card
to Lovelace UI as any other card (using either editor or YAML configuration).
This card can be configured using Lovelace UI editor.
- In Lovelace UI, click 3 dots in top left corner.
- Click Configure UI.
- Click Plus button to add a new card.
- Find Custom: Purifier Card in the list.
- Choose
entity
. - Now you should see the preview of the card!
Sorry, no support for actions
and stats
in visual config yet.
Typical example of using this card in YAML config would look like this:
type: 'custom:purifier-card'
entity: fan.purifier
stats:
- attribute: filter_life_remaining
unit: '%'
subtitle: Filter Remaining
- attribute: motor_speed
unit: RPS
subtitle: Motor Speed
actions:
- name: Silent
icon: 'mdi:weather-night'
speed: Silent
- name: 25%
icon: 'mdi:circle-slice-2'
speed: Favorite
xiaomi_miio_favorite_level: 3
- name: 50%
icon: 'mdi:circle-slice-4'
speed: Favorite
xiaomi_miio_favorite_level: 7
- name: 75%
icon: 'mdi:circle-slice-6'
speed: Favorite
xiaomi_miio_favorite_level: 10
- name: 100%
icon: 'mdi:circle-slice-8'
speed: Favorite
xiaomi_miio_favorite_level: 14
- name: Auto
icon: 'mdi:brightness-auto'
speed: Auto
show_name: true
show_state: true
show_toolbar: true
compact_view: false
Here is what every option means:
Name | Type | Default | Description |
---|---|---|---|
type |
string |
Required | custom:purifier-card |
entity |
string |
Required | An entity_id within the fan domain. |
show_name |
boolean |
true |
Show friendly name of the purifier. |
show_status |
boolean |
true |
Show status of the purifier. |
show_toolbar |
boolean |
true |
Show toolbar with actions. |
compact_view |
boolean |
false |
Compact view without image. |
aqi |
object |
Optional | Custom entity or attribute for AQI value. |
stats |
object |
Optional | Custom per state stats for your purifier cleaner |
actions |
object |
Optional | Custom actions for your purifier cleaner. |
Name | Type | Default | Description |
---|---|---|---|
entity_id |
string |
Optional | An entity_id with state, i.e. sensor.current_aqi . |
attribute |
string |
Optional | An attribute which should be used to get AQI value. |
unit |
string |
Optional | An unit of measurement to display. |
You can use any attribute of purifier or even any entity by entity_id
to display by stats section:
Name | Type | Default | Description |
---|---|---|---|
entity_id |
string |
Optional | An entity_id with state, i.e. sensor.purifier_aqi . |
attribute |
string |
Optional | Attribute name of the stat, i.e. filter_left . |
unit |
string |
Optional | Unit of measure, i.e. hours . |
subtitle |
string |
Optional | Friendly name of the stat, i.e. Filter . |
You can define custom scripts for custom actions or add shortcuts for switching modes and speeds via actions
option.
Name | Type | Default | Description |
---|---|---|---|
name |
string |
Optional | Friendly name of the action, i.e. Switch to Auto . |
icon |
string |
Optional | Any icon for action button. |
service |
string |
Optional | A service to call, i.e. script.clean_air . |
service_data |
object |
Optional | service_data for service call |
speed |
object |
Optional | A speed to switch to, i.e. Auto , etc |
xiaomi_miio_favorite_level |
object |
Optional | A favorite level of the operation mode Favorite for Xioami Air Purifiers. speed is required with this option |
The card will automatically try to figure out which one of actions is currently active. The action will be highlighted when:
- It's a service.
entity
'sspeed
attribute is equal toaction
'sspeed
.entity
'sspeed
attribute andfavorite_level
is equal toaction
'sspeed
andxiaomi_miio_favorite_level
correspondingly.
I've added an animation for this card to make it alive:
How did I make this animation? It's a long story…
- I took original gif file from here.
- Then I tweaked image levels to make the background black and purifier white.
- Then I inverted colors on the gif.
- Then I've split the gif by frame.
- Then I removed the background of the image frame by frame using remove.bg.
- Then I upscaled each of those images using icons8.com/upscaler.
- Then I put up all of those images back in a single gif.
- Profit!
Archive with images from all of these steps can be found here.
This card supports translations. Please, help to add more translations and improve existing ones. Here's a list of supported languages:
- English
- Українська (Ukrainian)
- Türkçe (Turkish)
- Français (French)
- Norsk (Norwegian)
- Polski (Polish)
- Български (Bulgarian)
- Your language?
This card relies on basic fan services, like toggle
, turn_on
, turn_off
, etc. It should work with any air purifier, however I can physically test it only with my own purifier.
If this card works with your air purifier, please open a PR and your model to the list.
- Air Purifier 3/3H
- Air Purifier 2/2H
- Air Purifier Pro
- Coway Airmega 300S/400S (using IoCare custom component)
- Your purifier?
Want to contribute to the project?
First of all, thanks! Check contributing guideline for more information.
This project is heavily inspired by:
- MacBury Smart House — basically, this project is a refinement of MacBury's custom card.
Huge thanks for their ideas and efforts 👍
MIT © Denys Dovhan