I am currently triggering an automation using a template as follows: value_template: "{{ (now() ).strftime('%H:%M') == states('sensor.time_01') }}"
This is working fine but I have been thinking about what would be more efficient in terms of processing power and resources etc.
Would it be more efficient to create a timestamp class sensor converting this to a template sensor of type timestamp and then using that to trigger the automation or does it make no difference at all?
your existing trigger is not super expensive other than that it needs to poll to check the trigger. I don’t think your alternative changes the resource load meaningfully at all
You can also just set the at: option of a time trigger to that of your sensor.
Although, it looks like your sensor only provides time. In that case you can also make a template sensor by passing the value through today_at and use that.
As for efficiency, I think all of your options come down to the same.
I tried that but for some reason it didn’t work. The sensor itself is created from a json API call response and is not marked as a timestamp in its device-class (I don’t know if that’s possible when creating the sensor in the API call anyway)
That means that I cannot use it to trigger the automation. I have already tried.
If it’s a REST sensor, you can fix that. Share the config and we can help.
Otherwise, if it’s from an integration that you can’t control, create a template sensor (UI, under Helpers) that copies the time into a timestamp-class sensor, then trigger off that.
What I get is “8:15” which I guess is not the correct ISO8601 format. I see “rendered invalid timestamp: 08:15” in the logs now (after adding device_class:timestamp).