For an on/off inverted, timed, switch; timer-bar-card does not show the timer until "on" is called in the script (at the end)
aredon opened this issue · 2 comments
Describe the bug
Possibly I'm doing this wrong but I would like to create a switch that disables an automation for a certain amount of time. I can't see any way to invert the behavior of the switch so I wrote my script to do "off" first and "on" second. Unfortunately this doesn't work and the timer is shown after the script has finished.
I could use a template switch to invert the state of the automation but at that point I might as well have the template switch call a timer. Seems a shame to not use this feature of the card.
Your card configuration
type: custom:timer-bar-card
entity: automation.motion_livingroom
name: Automation Test
icon: mdi:camera-timer
invert: true
duration:
script: script.motion_pause_livingroom
tap_action:
action: call-service
service: script.motion_pause_livingroom
hold_action:
action: more-info
mushroom:
icon_type: icon
icon_color: primary
...
alias: Motion - Pause Livingroom
sequence:
- service: homeassistant.turn_off
data: {}
target:
entity_id: automation.motion_livingroom
- delay: "00:00:10"
- service: homeassistant.turn_on
data: {}
target:
entity_id: automation.motion_livingroom
mode: restart
icon: mdi:motion-outline
Hey! If I understand correctly, you want the card to show the timer while the automation is off
, then turn off once the automation goes back to on
.
You'll need to set active_state
to off
(I might be wrong about this, but I think automations are in state off
when they're disabled). That should hopefully be the missing piece here.
Hey! If I understand correctly, you want the card to show the timer while the automation is
off
, then turn off once the automation goes back toon
.You'll need to set
active_state
tooff
(I might be wrong about this, but I think automations are in stateoff
when they're disabled). That should hopefully be the missing piece here.
Correct! The goal is basically to have a button that suspends motion control of a light. I also have it so pressing up on the inovelli switch starts the timer as well. So the automation being off is the timer on state.
I will need to test this method because I already created a work around with a template switch. Not sure when I'll find time to do that.