Hello all,
I’m new in Home Assistant and I really appreciate this tool.
I have searched for hours now in this blog but without succeeding.
I want to calculate an hour from one reference hours (12:00) substract or add a number of hour comming from an input_value. I want to use this calculation in automation as I have several conditions before.
An example of what I have tried :
- service: input_datetime.set_datetime
data:
time: {{ as_timestamp(strptime('12:00:00' , '%H:%M:%S') - ((states.input_number.piscine_nombre_fonctionnement_heure.state * 3600|int) / 2)) | timestamp_local }}
target:
entity_id: input_datetime.piscine_debut_periode
Then I have switched to development tool and test several things like:
{{ as_timestamp(strptime(states.input_datetime.piscine_heure_pivot.state , '%H:%M:%S')) - as_timestamp(strptime(states.input_number.piscine_nombre_fonctionnement_heure.state|int , '%H')) }}
but I have still error ‘Template error: strptime got invalid input ‘6’ when rendering template’.
All help is welcome
Thank you in advance.