TMB
1
I have an input_datetime entity that I would like to populate with the current time through an automation.
To test, I tried setting the state manually in the Developer Tools but I’m unable to.

But this results in this error:
input_datetime/set_datetime must contain at least one of date, time, datetime, timestamp.
CO_4X4
(Colorado Four Wheeler)
2
I don’t think you need the data template, I think you would just put:
value: '{{ now().strftime("%H:%M") }}'
TMB
3
Same error I’m afraid 
Also tried this with no luck
time: '{{ now().strftime("%H:%M") }}'
baunan
4
Have you specified input_datetime.time
correctly, https://www.home-assistant.io/integrations/input_datetime/?
I use this line to set the time one hour from now.
- service: input_datetime.set_datetime
entity_id: input_datetime.stue_pa
data:
datetime: '{{ (now().strftime("%s")|int +3600|int) |timestamp_custom("%Y-%m-%d %H:%M:%S", false) }}'
So trying changing time
with datetime
and see if that works first.
baunan
6
Just to verify and I am not sure if it is relevant for this entity, but have you activated time and date in Home Assistant?
I have this under group:
time_and_date:
name: Time and Date
entities:
- group.time_date_sensors
time_date_sensors:
name: Time Date
entities:
- sensor.date
- sensor.time
And your input_datetime.time is specified to have both time and date like this?
kamera_av:
name: Kamera av
has_date: true
has_time: true
icon: mdi:clock-in
TMB
7
I have the time_date platform set up, yes.
my input_datetime only has time activated as I’m not interested in the date.
baunan
8
Looks like the template doesn’t like this input, so perhaps report it as a bug.
But I just check it in the automation and the below works for me.
- service: input_datetime.set_datetime
entity_id: input_datetime.matbodvifte_av
data:
time: '{{ now().strftime("%H:%M") }}'
TMB
9
You’re right, it works perfectly in automations, just tested.
Thanks 