Write Input Datetime Helper in Datetime Helper

Hello,
i have actual the need to write the values from a Datetime Helper into another Datetime Helper but it does not work right now.

metadata: {}
data:
  time: "09:30:00"
target:
  entity_id: input_datetime.kg_h_kinderzimmer_wecker
action: input_datetime.set_datetime

I tried to exchange the “data” to an input_datetime but I am not allowed to safe this script. Is this even possible to write a Datetime into a Datetime?

Of course it is possible, but you cannot just enter an entity ID as the data for the action – you need to write a template that gets the state of the other input_datetime, and if both of them are not set to the same mode (date & time, time only or date only) then you may also need to do some data manipulation.

- action: input_datetime.set_datetime
  target:
    entity_id: input_datetime.target_datetime_helper
  data:
    datetime: "{{ states('input_datetime.source_datetime_helper') }}"

That was fast :slight_smile: I will check it directly thank you :slight_smile:

It let me save the automation but by triggering it I get this error:

metadata: {}
data:
  datetime: "{{ states('input_datetime.kg_h_kinderzimmer_wecker_wochentag') }}"
target:
  entity_id: input_datetime.kg_h_kinderzimmer_wecker
action: input_datetime.set_datetime

If both input_datetime helpers are set to time only, then the data input should be time (rather than datetime as in my example).

- action: input_datetime.set_datetime
  target:
    entity_id: input_datetime.kg_h_kinderzimmer_wecker
  data:
    time: "{{ states('input_datetime.kg_h_kinderzimmer_wecker_wochentag') }}"

Perfect. It seems to be working right now. I will test now the complete automation.

Edit: Automation worked exactly as expected. Thank you very much @Mayhem_SWE for your fast and productive support.