Skip to content

joseluis9595/lovelace-switch-timer-card

Repository files navigation

Switch Timer Card

Buy me a beer Last commit Downloads Version

Switch Timer Card is a custom Lovelace card for Home Assistant that provides a user-friendly interface to control a switch entity with added timer functionality. This card allows you to turn a switch ON or OFF and set a timer to automatically turn it off after a specified duration. It also features a collapsible design for a neat and organized UI.

switch-timer-card-preview.mov

InstallationUsage/InstructionsConfigurationExample configurationsHelpDonate


🚀 Installation

HACS manual configuration
  1. Go to HACS in Home Assistant.
  2. On the top right, click "Custom repositories".
  3. Enter the repository URL: https://github.com/joseluis9595/lovelace-switch-timer-card.git
  4. Search for "Switch Timer Card".
  5. Click Install!
Manual installation without HACS
  1. Download switch-timer-card.js from the latest release.
  2. Move this file to home assistant's <config>/www folder.
  3. In home assistant, go to Settings > Dashboards.
  4. On the top right corner, click Resources.
  5. Add a new resource with the following:
    • URL: /local/switch-timer-card.js
    • Resource type: JavaScript module
  6. Go to your dashboard, refresh your page and add your new switch-timer-card!



📖 Usage/Instructions

Before using the Switch Timer Card, you need to create a Timer Helper in Home Assistant. Follow these steps to set it up:

  1. Open your Home Assistant Configuration and navigate to "Configuration" > "Helpers."

Open your Home Assistant instance and show your helper entities.

  1. Click the "+ Add Helper" button.

  2. Choose "Timer" as the Helper type.

  3. Fill in the details for your timer, including a name and an optional icon.

  4. Save the Helper.

Now, you can add the Switch Timer Card to your Lovelace dashboard and configure it as follows:

type: custom:switch-timer-card
switch_entity: switch.your_switch_entity
timer_entity: timer.your_timer_entity
title: Title of the card
  • switch_entity: Replace switch.your_switch_entity with the entity ID of the switch you want to control.

  • timer_entity: Replace timer.your_timer_entity with the entity ID of the timer helper you created in Home Assistant.

  • title (optional): You can specify a title for the card if desired.




⚙️ Configuration

Name Type Default Description
switch_entity string Required Entity ID of the switch you want to control.
timer_entity string Required Entity ID of the timer helper used for this card.
title string - Optional title for the card. Will use the switch_entity friendly name by default.
buttons Button[] - Customizable array of buttons with different time lengths for the timer.

Button

Configuration for each button in switch-timer-card. You can configure the length of time with which the timer will start when pressing each button, plus manually configuring the text to display in the button if needed.

Name Type Default Description
seconds number - Seconds to add to the timer.
minutes number - Minutes to add to the timer.
hours number - Hours to add to the timer.
text number - Optional text to override the auto-generated human readable time.



📚 Example Configurations

example_configuration
type: custom:switch-timer-card
title: Room radiator
switch_entity: switch.radiator
timer_entity: timer.test_timer
buttons:
  - minutes: 30
  - minutes: 60
  - hours: 1
    minutes: 30



💬 Help

Need help using switch-timer-card, have ideas, or found a bug? Here's how you can reach out:

Your feedback helps make switch-timer-card better for everyone. Don’t hesitate to reach out!




🍻 Donate

If you enjoy using switch-timer-card and want to support its continued development, consider buying me a coffee (or a beer 🍺), or becoming a GitHub Sponsor!

Buy Me A Coffee GitHub Sponsors

Your support means a lot and helps keep the project alive and growing. Thank you! 🙌

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors