Skip to content

Custom Lovelace card for Garbage Collection custom component

License

Notifications You must be signed in to change notification settings

krayj/garbage-collection-card

 
 

Repository files navigation

hacs_badge

Buy me a coffee

Lovelace custom card for Garbage Collection

This Lovelace custom card displays garbage collection information provided by the Garbage Collection custom component you may find at https://github.com/bruxy70/Garbage-Collection.
It will draw your attention the day before the garbage collection by changing the icon color to your theme's active icon color by default.

Lovelace UI does not support platform attributes natively.
Implementation of handling attributes in Lovelace was inspired by entity-attributes-card.

Installation

The easiest way to install it is through HACS (Home Assistant Community Store), search for garbage and select Garbage Collection Card from Plugins.
If you are not using HACS, you may download garbage-collection-card.js and the translations directory and put them into homeassistant_config_dir/www/community/garbage-collection-card/ directory.
The card does not support configuration flow, therefore you'll have to add the resources via UI->Configuration ->Lovelace Dashboards->Resources then add the card manually editing the card configuration yaml on the dashboard at Add Card->Manual.

Lovelace UI configuration

Configuration parameters:

Name Optional Default Description
entity N - name of the sensor of garbage_collection platform.
due_color Y theme's icon active color icon color on due date. Accepts both color names and RGB values.
due_1_color Y due_color icon color on the day before due date. Accepts both color names and RGB values.
due_txt Y false For today/tomorrow pick-ups use 'Due today' or 'Due tomorrow'.
icon_color Y theme's icon color icon color. Accepts both color names and RGB values.
icon_size Y 25px size of the icon.
icon_cell_padding Y 35px padding applied to icon cell.
icon_cell_width Y 60px icon cell width.
hass_lang_priority Y false whether HASS language has priority over browser language.
hide_before Y -1 hide entire card until X days before event. Default: do not hide card.
hide_date Y false hide date.
hide_days Y false hide number of days. Automatically set to true when collection is due today or tomorrow.
hide_icon Y false hide icon.
hide_on_click Y true hide the card upon click when due date is today or tomorrow.
hide_title Y false hide title.
title_size Y 17px font size for the sensor's friendly name.
details_size Y 14px font size for date and number of days.

Garbage collection cards support some languages and display the date information based on your locale setting by default. You may override this to use the language set in HASS for displaying its frontend.

When garbage-collection sensors are used with verbose_state=True, hide_date and hide_days will be discarded, displayed text will be taken from the sensor's verbose_format.

When garbage collection is today or tomorrow, clicking on the card you can acknowledge that the garbage was prepared or collected and the card will be hidden until the day after due day or if hide_before is used, until X days before next due day.

Please add the card to the resources in configuration.yaml:

resources:
  //When using HACS installation method
  - {type: js, url: '/hacsfiles/garbage-collection-card/garbage-collection-card.js'}
  //When using manual install method
  - {type: js, url: '/local/garbage-collection-card.js'}

Please find below an example of ui-lovelace.yaml (entity should be the sensor of garbage_collection platform you defined):

    cards:
      - type: custom:garbage-collection-card
        entity: sensor.selective_waste
        icon_size: 35px
        icon_color: green
        hide_date: true
      - type: custom:garbage-collection-card
        entity: sensor.waste
        hide_before: 4
        icon_color: '#0561ba'

Basic card:
Garbage Collection card example

Different icon sizes and colors:
Different icon sizes

Thanks

Thanks to all the people who have contributed!

contributors

About

Custom Lovelace card for Garbage Collection custom component

Resources

License

Stars

Watchers

Forks

Packages

No packages published