Hello, as the documentation for input_datetime states, it is possible to use it in automations.
My aim is to use it for controlling the timings in my heatingplan.
I want to use an input_datetime to start the heating on weakdays and one where the heating should stop.
But the docs don’t state, how to use it as a trigger.
I’d probably use the input_datetime with a time based trigger, so it only fires at a certain time, then breaking the weekday bit out into a condition. That would make the time trigger times configurable via the UI. Take a look at this doc, and the time trigger to see what it’s expecting:
Also make 2 input_datetime entity’s so you have something to work with. You’ll most likely have to use a template to pull the input_datetime state into the trigger. So if you haven’t yet, read up on template creation:
Also once the input_datetime entity’s are created, and HA is restarted, you’ll be able to use the developer tools -> template editor, which should help you in writing the templates.
I have the same question. The documentation does not help me.
I simply want to use the input date time to change the time trigger (07:00) for the automation via UI.
input_datetime.zeit_sonnenaufgang is set to 07:00. But how to add as trigger?
I have a feeling, that this triggers the automation multiple times.
Therefore I am thinking of transferring the trigger to a binary template sensor and building the trigger around that.
The sensor stays in his state and so the automation is only triggered once.
heating_on_weekday:
friendly_name: "Heizung an in der Woche"
value_template: "{{ (states.input_datetime.heating_on_weekday.attributes.timestamp | int | timestamp_custom("%H:%M", False)) == states.sensor.time.state }}"
Yeah, I think that my initial setup triggered the automation every second, thats why I changed to using binary template sensors for all my input_datetime related triggers.
Works like a charm.
Thank you Mikael! After trying various solutions for days, yours was the only one that worked. AND, you get a nice “system time” display along with it. Only too bad I found your post last.