Can anyone help explain why my timer correctly runs out to the full duration, however the countdown display on the dashboard always starts at 30 seconds less whatever I put in?
E.g for this 2 minute, (OK one second after hitting it!) I get this:
Or if it’s a 1 min timer, it displays 30 etc etc.
Then at the end of the last 30 seconds, just displays ‘Active’, then finally at the ‘real’ zero, switches to idle.
In other words, although it works correctly, the display is always 30 seconds fast.
This is my script to start the timeer:
alias: 'Timer Start Seth '
sequence:
- service: timer.start
data_template:
entity_id: timer.seth_timer
duration: 00:{{ states('input_number.timer_minutes') | int }}:00
mode: single
icon: mdi:alpha-s-circle-outline
The timer and input number are just very basic helpers.
Thanks!!
Okechuku
(Okechuku)
December 23, 2022, 2:17am
42
how does this trigger the timer? When I click the button, the light toggles, but the timer still remains ‘idle’.
Also, before the timer is triggered, the button shows idle. Is there anyway to hide this ‘idle’ while the timer has not yet been started, and only display the time counting down on the button only while the timer is active?
jmwick
(Jmwick)
February 13, 2023, 1:20am
43
Here’s an update to my button timer view. I’ve now incorporated a bar-card that displays the remaining time as a progress bar underneath the button status.
type: horizontal-stack
cards:
- type: vertical-stack
cards:
- type: custom:button-card
entity: switch.back_porch_switches
icon: mdi:coach-lamp
name: B. Porch
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
- type: conditional
conditions:
- entity: timer.back_porch
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.back_porch_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
entity: switch.front_porch
icon: mdi:coach-lamp
name: F. Porch
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
- type: conditional
conditions:
- entity: timer.front_porch
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.front_porch_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
entity: light.driveways
icon: mdi:outdoor-lamp
name: Driveway
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
- type: conditional
conditions:
- entity: timer.driveway
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.driveway_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
entity: switch.garage
icon: mdi:lightbulb
name: Garage
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
tap_action:
action: toggle
hold_action:
action: more-info
double_tap_action:
action: more-info
- type: conditional
conditions:
- entity: timer.garage
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.garage_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
entity: switch.utility
icon: mdi:lightbulb
name: Utility
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
- type: conditional
conditions:
- entity: timer.diffuser
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.diffuser_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
entity: light.kitchen_bar
icon: mdi:glass-mug
name: Kit. Bar
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
- type: conditional
conditions:
- entity: timer.kitchen_bar
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.kitchen_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
icon: mdi:spotlight-beam
entity: light.kitchen_main
name: Kit. Main
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
animation:
state: 'on'
tap_action:
action: toggle
hold_action:
action: call-service
repeat: 1000
service: script.kitchen_main_cycle
double_tap_action:
action: more-info
- type: conditional
conditions:
- entity: timer.kitchen_main
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
tap_action:
action: call-service
service: script.timer_kitchen_main_toggle
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.kitchen_main_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
icon: mdi:lightbulb-group
entity: light.kitchen_cabinets
name: Kit. Cabinets
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
animation:
state: 'on'
- type: conditional
conditions:
- entity: timer.kitchen_main
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.kitchen_main_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
icon: mdi:ceiling-light
entity: light.kitchen_dining
name: Kit. Dining
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
animation:
state: 'on'
- type: conditional
conditions:
- entity: timer.kitchen_main
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.kitchen_main_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
icon: mdi:globe-light
entity: switch.hallway
name: Hallway
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
animation:
state: 'on'
- type: conditional
conditions:
- entity: timer.hallway
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.hallway_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
icon: mdi:string-lights
entity: light.led_controller
name: House
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
animation:
state: 'on'
- type: conditional
conditions:
- entity: timer.house
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.house_timer_percent
- type: vertical-stack
cards:
- type: custom:button-card
icon: mdi:lamp
entity: light.futon_lamp
name: Futon
color_type: icon
state:
- value: 'on'
color: '#FEB90F'
show_state: false
show_label: true
show_icon: true
animation:
state: 'on'
- type: conditional
conditions:
- entity: timer.futon
state_not: idle
card:
type: custom:bar-card
style: |
.card-content {
padding: 0px;
margin-top: -8px;
}
height: 4px
positions:
icon: 'off'
indicator: 'off'
name: 'off'
value: 'off'
entities:
- entity: sensor.futon_timer_percent
3 Likes
jmwick
(Jmwick)
February 13, 2023, 10:32pm
44
Also, here’s an example of a template for creating the timer percentages:
driveway_timer_percent:
unit_of_measurement: "%"
#entity_id: sensor.time
value_template: >
{% set timer = 'driveway' %}
{% if is_state('timer.'~timer,'active') %}
{% set state = states.timer[timer] %}
{% set dur = state.attributes.duration.split(':') %}
{% set dur = ((dur[0]|int)*60+dur[1]|int)*60+dur[2]|int %}
{{ ((dur - (now() - state.last_changed).total_seconds())/dur*100)|int }}
{% else %}
100
{% endif %}