Hi,
I am still learning my way round HA, but loving its capability.
I want to be able to set a date and time in the future to automate an action (inhibiting the hot water heater when away on holiday).
I have created a datetime helper, which collects the date and time fine.
The problem is how to include the date in an automation. I can use the ‘time’ condition in the automation UI, but that just looks at the time component of the datetime helper, and doesnt check whether the date has passed. I cant see how to get the date checked a a condition. Does it need to be done in YAML, or do I need to use a template?
I have dug around in the documentation and other questions on this forum, and havent found an answer.
This will give you a sensor called binary_sensor.on_vacation that will have a state of “on” when the current time and date is between your start and end datetimes, otherwise it will be “off”. Then, in you automation(s), you add a State condition:
condition:
- condition: state
entity_id: binary_sensor.on_vacation
state: 'off'
I am trying to do similar to this. I cannot get it to work, I am using various calculations and it feels like input_datetime (only using time element) is not a properly formatted time? athough the developer tools show it as 08:39:09 for example…
I’ve tried various ways of doing this then hit a brick wall with errors like TypeError: ‘<=’ not supported between instances of ‘str’ and ‘datetime.datetime’