I have a piece of code that works fine in the Template editor, returning a value like 06:45:00 but, it gives me an error in te automation: Unable to determine action @ data[0]
I cannot figure out why. The input_datetime helpers are set to Time only, triple checked that.
Can anyone give a hint how to make this work in the automation as well?
Using the latest HA build.
Thank you for your answer.
I did try those options, but to now avail.
When I change value to time I get the error: Service does not match format . for dictionary value @ data[0][‘service’]
While trying and retrying to get the date calculation working with various statements, I fell into the trap I thought I double checked… I used double qoutes in one of the time formats: “%H:%M:%S”
I should learn to check on quotes again when I lazily copy and paste some code…
That’s a minor syntax error compared to using a non-existent option like value.
Your template may not even need to use strptime and strftime depending on how the Input Datetime helper is configured. Is it configured to store time only or both date and time?
In that case, you can use today_at to convert the time string to a datetime object. Subtract the timedelta object from the datetime object and then convert the result to a timestamp value.