Increase 1 minute in an input_datetime

That’s the question. First of all, sorry for the newbie question but i’m not able to find the syntax for increase this entity input_datetime.tiemposemanalcalefaccion as input.datetime in one minute inside and automation.

Something like input_datetime.tiemposemanalcalefaccion = input_datetime.tiemposemanalcalefaccion + 60 seconds.

Thanks in advance

Here it is:

{{(((state_attr('input_datetime.tiemposemanalcalefaccion' , 'timestamp')) + 60) | timestamp_custom('%H:%M', true))}}
1 Like

Assuming your input datetime is time-only, you can change it’s value by +60 seconds in an automation by using the following service call in your actions:

- service: input_datetime.set_datetime
  target:
    entity_id: input_datetime.tiemposemanalcalefaccion
  data:
    time: >
      {{ (today_at(states('input_datetime.tiemposemanalcalefaccion')) +
      timedelta(seconds=60)).strftime('%H:%M:%S') }}

By using today_at(), you can avoid the timezone and daylight saving-related issues that can happen using the timestamp method.

2 Likes

Thanks @browetd and @Didgeridrew for the quickly response. Both it works for me.

Chapeau!