#Set a timer on dashboard
1 messages · Page 1 of 1 (latest)
I'm going to show you how I have my timers configured. I had to take a "roundabout" approach in order to be able to change the timer's duration via the dashboard. For automations using timers, I have the following entities: a timer, an input_number, and an input_boolean. (I use the input_boolean, to control whether the timer should be used or not; this is handled in the automation.)
To set up the helpers, go to Settings > Devices & services > Helpers tab > Create helper (in bottom right). For the input_boolean, select toggle. For the input_number, select number. Here, give it a name, icon, min/max values, and step. Ensure the display mode is set to slider.
In the dashboard, I make adjustments to the input_number entity (not the actual timer entity). I've set up two different methods for adjusting. First uses an auto entities card to find the appropriate input_number entities (they all begin with input_number.automation....) ```yaml
type: custom:auto-entities
card:
type: entities
show_header_toggle: false
state_color: true
show_state: true
card_mod:
style: |
ha-card {
border: solid 1px var(--primary-text-color);
background-color: rgba(0, 0, 0, 0)
}
filter:
include:
- entity_id: input_number.automation*
domain: input_number
exclude: []
sort:
method: friendly_name
reverse: false
The second display method uses a custom:button-card. In theory, this could be incorporated with the auto-entities card to find the entities but I never put enough work into it in order to get it to work properly. This card can handle the input_number and input_boolean at the same time. It also relies on the slider-entity-row card.```yaml
type: custom:button-card
entity: input_boolean.automation_auto_hallway_lights
name: Hallway
styles:
card:
- height: 40px
- width: 600px
- border-radius: 15px
- font-size: 14px
- padding-bottom: 0px
- padding-top: 0px
- padding-right: 5px
- border: none
- background-color: transparent
grid:
- grid-template-areas: ""i n slider markdown""
- grid-template-columns: 4em 1fr 40% 20%
- grid-template-rows: auto
name:
- justify-self: start
markdown:
- font-size: 12px
custom_fields:
slider:
card:
full_row: true
type: custom:slider-entity-row
entity: input_number.automation_auto_hallway_lights_duration
hide_state: true
markdown:
card:
type: markdown
content: >
{{-
states.input_number.automation_auto_hallway_lights_duration.state
|int| string +" minutes"-}}
card_mod:
style: |
ha-card {
border: none;
background-color: transparent;
}
While I used sliders for my configuration, it wouldn't take much to configure up/down buttons that can adjust the value of the input_number. I also use a step of 5 to set 5 minute increments.
Next, in the automation, add an action for Timer Start. But, in order to get it to use the value from the input_number, we have to edit in YAML and add a template. Select the timer entity, click the three dots at the right of the action, then Edit in YAML. This is what it should look like: yaml data: duration: >- {{ states.input_number.automation_auto_hallway_lights_duration.state | int(0)*60 }} target: entity_id: - timer.automation_auto_hallway_lights action: timer.startThe duration block references the input_number, converts it to an integer and multiplies by 60 to convert the value to seconds.