Hi, i am working on a new automation, among the various things he will have to do, I need him to add time to a time helper. For now everything is ok but I realized that the code I wrote does not reflect the Daylight saving time (DST):
alias: Gestione luci stanzetta
description: ""
trigger:
- platform: state
entity_id:
- input_datetime.luce_on
condition: []
action:
- service: input_datetime.set_datetime
data:
datetime: >-
{{ (state_attr('input_datetime.luce_on', 'timestamp') + 60 ) |
timestamp_custom ('%Y-%m-%d %H:%M:%S') }}
target:
entity_id: input_datetime.luce_off
mode: single
In this case if i set input_datetime.luce_on to 09:00 the input_datetime.luce_off become 10:01
A workaroud that i have tried is to subtract 3600 seconds:
{{ (state_attr(‘input_datetime.luce_on’, ‘timestamp’) + 60 - 3600 )
But it seems to me a dirty solution, I wondered if there was a way to calculate the DST period in a cleaner way.
Thank you