Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95445

Error when configuring timing duration using template

$
0
0

@theone wrote:

I am trying to use a the timer.start service in a script. The duration should be configured using an input.number entity “irrigation_set_time”.

  • I tried using both the time format HH:MM:SS and the seconds - both return errors.

HH:MM:SS code:

service: timer.start
data_template:
        entity_id: irrigation_timer_cycle_duration
        duration: "{{ states('input_number.irrigation_set_time') | int | timestamp_custom('%H:%M:%S',false) }}"

error:

Failed to call service timer/start. offset {{ states('input_number.irrigation_set_time') | int | timestamp_custom('%H:%M:%S',False) }} should be format 'HH:MM' or 'HH:MM:SS' for dictionary value @ data['duration']

Integer code:

service: timer.start
data_template:
  entity_id: irrigation_timer_cycle_duration
  duration:
    seconds: "{{ states('input_number.irrigation_set_time') | int }}"

error:

Failed to call service timer/start. expected int for dictionary value @ data['duration']['seconds']
  • The same errors appear when I run the service and data_template using the “Service” menu in “Development Tools”.
  • I tried the template {{ }} code in “Template Editor” (under “Development Tools”) and it returned the correct format in both cases (HH:MM:SS format and integer respectivley)

What is puzzling it that I tried running the same HH:MM:SS code using the delay function and it worked OK.

delay: "{{ states('input_number.irrigation_set_time') | int | timestamp_custom('%H:%M:%S',false) }}"

What could me the problem? Using latest HA 0.108.3

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>