Hi!
I’am trying to create a timer by adding a number input with a slider to ajust the minutes and a button to start the countdown. The number input is typ float and therefore i get 22.0 (e g.) instead of 22. So i have to convert the input to int. This is my approch, which does not work:
The timer works fine when i hardcode the duration. What do i missunderstand?
- type: custom:mod-card
style: |
ha-card {
margin-left: 7px;
margin-right: 7px;
}
card:
type: vertical-stack
cards:
- type: markdown
title: Music Timer
content: Test
- type: button
name: Start Stop Timer
icon: mdi:power
show_name: false
show_icon: true
show_state: true
tap_action:
action: call-service
service: timer.start
service_data:
entity_id: timer.musik_timer
# Conversation to String "00:30:00" fails:
duration: "00:{{ (states.input_number.timer_minutes.state | int ) }}:00"
# hardcoding works:
# duration: "00:30:00"
- type: entities
entities:
- entity: input_number.timer_minutes
name: Countdown in Minuten
- entity: timer.musik_timer
name: Timer
7 posts - 4 participants