Set initial on date time inpute as template?

Is possible to set the “initial” args of the date time input as a template? in particular I would like to set the time as now + 1 hour.

No, but you can use an automation triggered by the homeassistant start event to set the value of an input_datetime to the current time, or even the current time + one hour.

Personally I find the input_datetime difficult to use. You can’t set both the date and time with a single template, so now() will advance slightly between the two, making it possible to get inconsistent data. I prefer to use an input_number to record a timestamp, since very often datetimes are converted to timestamps when they’re used anyway.

1 Like

Thanks @pnbruckner. Can you help me with the template of the start event?

input_number:
  ha_start_timestamp:
    name: HA Start Timestamp
    min: 0
    max: 5000000000
automation:
  - alias: Record HA start timestamp
    trigger:
      platform: homeassistant
      event: start
    action:
      service: input_number.set_value
      entity_id: input_number.ha_start_timestamp
      data_template:
        value: "{{ as_timestamp(now()) }}"

If you’d rather record the start time plus one hour, then:

        value: "{{ as_timestamp(now()) + 60*60 }}"
1 Like

Update: You can now that I added that feature. :slightly_smiling_face: