I have a question about the offset option of an automation trigger: My plan is to use the sun attribute “next_rising” timestamp to dynamically delay the closing of the cover depending on the month. I.e. in summer the delay should be around 20-40min in winter just a few minutes as the sun sets more rapidly.
As the delay value of the trigger should be in the form of ‘HH:MM:SS’ I made the following templating:
But I could not insert it as trigger offset (in YAML mode). After copying my text to “offset” it simply disappears. Could someone help me out … but maybe I follow a strange route here and I could not solve my problem with the offset?
This line creates a variable named rising containing the date and time (as local time) represented as a datetime object.
{% set rising = states('sensor.sun_next_rising') | as_datetime | as_local %}
This portion subtracts 20 minutes from rising and converts the result into a time string containing hours and minutes. This is the “offset rising time”.