Hi, I want to implement a button that either starts a timer with 15 min, or will extend it by another 15 min, if it is already running.
I tested it out in the template playground, but can't get it to work on the dashboard.
show_name: true
show_icon: true
type: button
entity: timer.luftungstufe3
name: Verlängere Stufe 3 um 15 min
tap_action:
action: perform-action
perform_action: timer.start
data:
duration: >-
{%- if is_state("timer.luftungstufe3","active") -%}{{-
(as_datetime(state_attr("timer.luftungstufe3","finishes_at")) - now() +
timedelta(minutes=15.0) ).total_seconds() | timestamp_custom("%H:%M:%S",
false) -}}{%- else -%}"00:15:00"{%- endif -%}
target:
entity_id: timer.luftungstufe3
This will just result in
{
"code": "invalid_format",
"message": "offset {%- if is_state("timer.luftungstufe3","active") -%}{{- (as_datetime(state_attr("timer.luftungstufe3","finishes_at")) - now() + timedelta(minutes=15.0) ).total_seconds() | timestamp_custom("%H:%M:%S", false) -}}{%- else -%}"00:15:00"{%- endif -%} should be format 'HH:MM', 'HH:MM:SS' or 'HH:MM:SS.F' for dictionary value @ data['duration']"
}
Above duration validates to "00:15:00" (not active) | "00:29:33" (active with 14:33 remaning) just fine as template!
But I can't even put{{ "00:15:00" }}there. It is all failing.
Any ideas?