Skip to content

A Lovelace card that shows a the PM index and risk level for Home Assistant

License

Notifications You must be signed in to change notification settings

MelleD/pm-index-card

Repository files navigation

PM Index card

release downloads build PayPal.Me BuyMeCoffee

Introduction

A custom Lovelace card that displays the PM (2.5 or 10) index and risk level in Home Assistant.

The card was copied from the uv-index-card. Big thank you @t1gr0u for allowing me to copy and adapt the card.

Installation

HACS (Home Assistant Community Store)

  1. Go to HACS page on your Home Assistant instance
  2. Select Frontend
  3. Press add icon and search for pm-index
  4. Select PM Index Card repo and install
  5. Force refresh the Home Assistant page (Ctrl + F5)
  6. Add pm-index-card to your page

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

Manual

  1. Download the 'pm-index-card.js' from the latest release (with right click, save link as)
  2. Place the downloaded file on your Home Assistant machine in the config/www folder (when there is no www folder in the folder where your configuration.yaml file is, create it and place the file there)
  3. In Home Assistant go to Configuration->Lovelace Dashboards->Resources (When there is no resources tag on the Lovelace Dashboard page, enable advanced mode in your account settings, and retry this step)
  4. Add a new resource
    1. Url = /local/pm-index-card.js
    2. Resource type = module
  5. Force refresh the Home Assistant page (Ctrl + F5)
  6. Add pm-index-card to your page

Using the card

  • Add the card with the visual editor
  • Or add the card manually with the following (minimal) configuration:
type: custom:pm-index-card
entity: sensor.pm_2_5

Lovelace Examples

Default

type: custom:pm-index-card
entity: sensor.pm_2_5

Card1

Card2

Options

Name Type Requirement Description Default
type string Required custom:pm-index-card
name string Optional Card name PM Index
show_error boolean Optional Show what an error looks like for the card false
show_warning boolean Optional Show what a warning looks like for the card false
pm_10 boolean Optional Use pm 10 (true) or 2.5 (false) index scala false
show_recommendation boolean Optional Show health description true
entity string Required Home Assistant entity ID. none
language string Optional The 2 character that determines the language en
tap_action object Optional Action to take on tap action: more-info
hold_action object Optional Action to take on hold none
double_tap_action object Optional Action to take on double tap none

Action Options

Name Type Requirement Description Default
action string Required Action to perform (more-info, toggle, call-service, navigate url, none) more-info
navigation_path string Optional Path to navigate to (e.g. /lovelace/0/) when action defined as navigate none
url string Optional URL to open on click when action is url. The URL will open in a new tab none
service string Optional Service to call (e.g. media_player.media_play_pause) when action defined as call-service none
service_data object Optional Service data to include (e.g. entity_id: media_player.bedroom) when action defined as call-service none
haptic string Optional Haptic feedback success, warning, failure, light, medium, heavy, selection none
repeat number Optional How often to repeat the hold_action in milliseconds. none

Language

The following languages are supported:

Language Yaml value Supported Translated by
English en v1.0.0 @MelleD
German de v1.0.0 @MelleD

How to add a language

If you wish to add a language please follow these steps:

  • Go into the src/localize/languages/ folder
  • Duplicate the en.json and name it as the language that you would like to add by following the 2 characters ISO language code
  • Then modify the localize.ts file, located in src/localize/ to include your language file.
  • Update the Readme.md, found in src/ to include your language and your Github username in the language table.

Thanks to

  • @t1gr0u for the uv-index-card, which I copied and adapted. I really like the card and use it for my UV Index.

Support

Clone and create a PR to help make the card even better.

Please ⭐️ or sponsor this repo when you like it.

Sponsor ❤️

PayPal.Me MelleDennis

Buy Me A Coffee

About

A Lovelace card that shows a the PM index and risk level for Home Assistant

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •