Ector73
(ector)
December 9, 2024, 11:47am
1
Hi,
I wanted to set the value of “input_datetime.calendario_data_fine” using the state of “input_datetime.calendario_data_inizio” plus 1 day.
I tried different approaches but to no avail…like this:
action: input_datetime.set_datetime
metadata: {}
target:
entity_id: input_datetime.calendario_data_fine
data:
date: "{{ (strptime(states('input_datetime.calendario_data_inizio'), '%Y-%m-%d') + timedelta(days=1)) }}"
Ector73
(ector)
December 9, 2024, 2:26pm
2
Found the problem: the string is correct, but “datetime” should be inserted and not “date”. I’m writing it for future reference.
action: input_datetime.set_datetime
metadata: {}
target:
entity_id: input_datetime.calendario_data_fine
data:
datetime: "{{ (strptime(states('input_datetime.calendario_data_inizio'), '%Y-%m-%d') + timedelta(days=1)) }}"