gyle
(gyle)
January 26, 2024, 8:30pm
1
Hi,
in a script i’ve defined a field einschaltdauer
(which is a input_number) and the first if-clause won’t work…!?
what am i doing wrong with the format of my template - i’m trying to first do a comparison and if true do a multiplication .:
`
- if:
condition: template
value_template: "{{ (float(states(einschaltdauer|int)))<60 }}"
then:
- service: homematicip_local.switch_set_on_time
data:
on_time: "{{ einschaltdauer|int(0)*60 }}"
target:
entity_id: "{{homematic_kanal_entity}}"
tom_l
January 26, 2024, 10:49pm
3
Without seeing how you defined einschaltdauer
this is difficult to answer. Please ensure you include all relevant information in future questions.
Assuming einschaltdauer
contains the input number entity id and not the value:
- if:
- condition: template
value_template: "{{ states(einschaltdauer)|int < 60 }}"
then:
- service: homematicip_local.switch_set_on_time
data:
on_time: "{{ states(einschaltdauer)|int * 60 }}"
target:
entity_id: "{{homematic_kanal_entity}}"
If einschaltdauer
contains the value of the input number then you would do this:
- if:
- condition: template
value_template: "{{ einschaltdauer|int < 60 }}"
then:
- service: homematicip_local.switch_set_on_time
data:
on_time: "{{ einschaltdauer|int * 60 }}"
target:
entity_id: "{{homematic_kanal_entity}}"
1 Like