Service: input_datetime.set_datetime

Hi

i have a datetime helper and i need your help in order to run the service: input_datetime.set_datetime and set the date as sysdate+7 and time as 06.00

Hey,
try this:

- service: input_datetime.set_datetime
  target:
    entity_id: input_datetime.XXX
  data:
    datetime: "{{ (now() + timedelta(days=6)).strftime('%Y-%m-%d 06:00:00') }}"

Beware that this will always add 6 days, irrespective of whether it’s before or after 6:00:00

1 Like
- service: input_datetime.set_datetime
  target:
    entity_id: input_datetime.your_datetime
  data:
    timestamp: "{{ (today_at('06:00:00') + timedelta(days=7)).timestamp() }}"

Nice, that’s a lot cleaner :ok_hand: