Timer-bar not working properly when the action is made on an entity but the duration is taken from a script
tehnic1service opened this issue · comments
tehnic1service commented
Preconditions:
- Home assistant core: 2023.11.3 or 2023.12.1
- Home assistant OS: 11.1 or 11.2
- HACS: 1.33.0
- Mushroom: 3.2.2
- Timer bar card: 1.29.1
- Chrome browser 119 on Sonoma 14.1.2 or Home Assistant app on Android 12
Defects description:
- Mushroom styling and clasic style not working properly when taking duration from a script
Screen.Recording.2023-12-10.at.00.17.36.mov
- When the timer-bar works, the script fail to finish. Maybe because the parent_id in the first context is missing?
When the timer-bar is not working, the script works as expected:
The only way to make the time bar appear, is to trigger the timer twice in the defined interval
Card configuration
type: custom:timer-bar-card
entity: switch.comanda_electrovalve_aspersoare_aspersoare_spate
duration:
script: script.temporizator_spate
name: Mushroom style
invert: true
bar_direction: rtl
bar_width: 60%
mushroom:
layout: horizontal
color: green
hold_action:
action: toggle
sync_issues: ignore
debug: true
Automation configuration
alias: Temporizator gazon spate
description: ""
trigger:
- platform: state
entity_id:
- switch.comanda_electrovalve_aspersoare_aspersoare_spate
from: "off"
to: "on"
for:
hours: 0
minutes: 0
seconds: 0
condition: []
action:
- service: script.toggle
data: {}
target:
entity_id: script.temporizator_spate
mode: single
Script configuration
alias: Temporizator spate
sequence:
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.comanda_electrovalve_aspersoare_aspersoare_spate
mode: single
Debug information
This behaviour happens only when the action triggers an entity but the duration is taken form a script.
A working example:
**Same script, same automation, triggering the script **
type: custom:timer-bar-card
entity: script.temporizator_spate
duration:
script: script.temporizator_spate
name: Mushroom style
invert: true
bar_direction: rtl
bar_width: 60%
mushroom:
layout: horizontal
color: green
hold_action:
action: toggle
sync_issues: ignore
debug: true
The downside of this option is that if I want to interrupt the sequence from the timer, only the timer on the card stops, but the script still runs for the remaining time.