What would be the proper syntax if I wanted to use a sensor as the time in which to evaluate the time condition? Would it be a time condition or a template?
It’s not exactly clear to me what you’re asking. Do you mean you have a sensor whose value is a time, and you want to use the value of that sensor in a time condition of an automation or script, comparing it against the current time in some way?
You got it.
Ok. Of course I don’t know exactly what your sensor is, or how you want to compare it to time, but here’s an example of how you might do this. Let’s say your sensor is sensor.my_time_sensor
, and it’s value is a time in the “usual” format. Then you could do something like this in your automation:
...
condition:
condition: template
value_template: "{{ as_timestamp(now()) > as_timestamp(states('sensor.my_time_sensor')) }}"
...
More details can be found here:
Thank you, I will give this a go. My format is 24h.
By “usual format” I really meant a format that as_timestamp()
will accept.