Hello,
I am an experienced software developer but still a beginner with HA (started just a few weeks ago). I am trying to control the duration of a timer with a variable (the bigger picture is I want to create an oscillator to control a heater’s duty cycle).
I am using a recent version: 2023.10.5
I have defined two entities:
- timer.pwm_timer
- input_number.pwm_timer_duration
I have defined two cards:
type: entities
entities:
- entity: input_number.pwm_timer_duration
- entity: timer.pwm_timer
secondary_info: none
type: button
show_name: true
show_icon: true
entity: timer.pwm_timer
tap_action:
action: call-service
service: timer.start
target:
entity_id: timer.pwm_timer
data:
duration: >-
{{states('input_number.pwm_timer_duration')|int|timestamp_custom("%X",false)}}
hold_action:
action: none
icon_height: 32px
The following returns the expected values in Developer Tools > Template Editor:
{{states('input_number.pwm_timer_duration')}}
{{states('input_number.pwm_timer_duration')|int|timestamp_custom("%X",false)}}
Shows
50.0
00:00:50
But when I click the button, I get the following error:
Where is the mistake?