Hello, I am using the UI to take the action of setting the internet end time “today” from a reference helper, both of which were defined in the UI. Here’s the UI:
(the UI seems to have changed the quotes from double to single and vice versa - I tried manually editing automations.yaml but either quote setting fails with the same error )
The template string above, when placed in the template editor properly returns the time I’m looking for, but somehow I keep getting the following error:
Choose at step 1: default: Error executing script. Invalid data for call_service at pos 1: must contain at least one of date, time, datetime, timestamp.
Multiple hours on this, had a kind soul on Discord help with the states(input_date…) portion, but stuck again.
Are you sure, that input_datetime.internet_everett_school_day_off_time only contains a time, and not a date as well? Otherwise you would have a type mismatch.
Thanks, yes it only contains time. It was created with the UI choosing the time radio button and I have confirmed the “has time true” and “has date false” flags in the config files.
I can’t duplicate the problem you have encountered.
Using version 2020.12.1, I created two input_datetime entities, both hold time only, then created the following script to assign one entity’s value to the other.
alias: New Script 1
sequence:
- service: input_datetime.set_datetime
data:
time: '{{ states(''input_datetime.start'') }}'
entity_id: input_datetime.alarm_time
mode: single
It worked. The value of 14:35 contained by input_datetime.start was assigned to input_datetime.alarm_time.
OK, figured this out - my automation actually has multiple choose/option alternatives, and one of the helper fields was defined as a date and not a time. I was thrown off because the error flags “Step 1, position 1” but actually it was the third helper in the list being tested that failed. So, not 0 indexed or 1 indexed (not sure how the errors are counting options). Regardless, once I fixed the third helper to just be time, the whole automation executed and worked as intended. Appreciate the confirmation that the syntax was correct!