I have two date and time helpers which I use to input when we are gone on a vacation (one named “departure” and “arrival”). I want my house to be warm when we come home. I figure the best practice is to create a helper based on the “departure” helper. If I could create an helper which takes the arrival time- and date and subtracts 4-5 hours, I could use that to “prepare the house” for our arrival (warm up, run the vacuum, run air-vents etc.
Convert the Input Datetime’s value from a datetime string to a datetime object then subtract the desired number of hours by representing it as a timedelta object.
Copy-paste the template into the Template Editor, change the Input Datetime’s entity_id to match yours then confirm it reports the desired date and time.
The template can be used to create a Template Sensor Helper. Set its device_class to timestamp and use this version of the template: