This repository contains YAML configurations for Home Assistant Lovelace cards that display countdowns to various holidays.
To use these cards, you will need to have the following custom components installed from the Home Assistant Community Store (HACS):
- button-card
- card-mod (version 4 is required)
-
Copy the files:
- Place the
template.yamlfile in your Home Assistantconfigdirectory.
- Place the
-
Include the template sensors: Add the following line to your
configuration.yamlfile. If you already have atemplate:section, add the!includeline under it.template: !include template.yaml
Or....if you don't like messing with configuration files.
Go to your Helpers tab
Create Helper
Template --> Sensor
Give it the same name and paste it in from the single Holiday in templates.yaml
Example: Name it "Days Until Christmas"
{% set today = now().date() %} {% set christmas = strptime(today.year ~ "-12-25", "%Y-%m-%d").date() %} {% if today > christmas %}
{% set christmas = strptime((today.year + 1) ~ "-12-25", "%Y-%m-%d").date() %}
{% endif %} {{ (christmas - today).days }}
Each card is a custom:button-card. To use them in your Lovelace dashboard, you can either copy the contents of the card's YAML file into a manual card, or use !include to include the card configuration from the file.
The cards use a background image. You can use any image you like.
-
Place the image in the
wwwdirectory: Place your desired background image in thewwwdirectory of your Home Assistantconfigfolder. If thewwwdirectory does not exist, you will need to create it. -
Reference the image in the card configuration: In the card's YAML configuration, the background image is referenced using
/local/. For example, if you place an image namedChristmas.jpgin thewwwdirectory, the path in the card configuration should be/local/Christmas.jpg.styles: card: - background-image: url("/local/Pictures/Christmas.jpg")
You will need to update the
background-imagepath in each card's configuration to point to the image you have chosen.
