The template just gets the input_number_HOURS and input_number_MINUTES, converts them to seconds, addd them together and compare it to when the room_fan state was last changed.
In HASS template tester it worksā¦ Ends up with either a true or false statement.
I can think of two reason why it doesnt work when put into automation.yaml:
[homeassistant.helpers.condition] Error during template condition: UndefinedError: āNoneā has no attribute āstateā
Hass doesnt āloop testsā the templateā¦ so after x minutes it could end with a true statements, thus triggering the automation
This wonāt update because you are using the now() method for a time based trigger. The now() method does not let home assistant know when it needs to trigger because it isnāt a state object. In laymens terms, you need a state object like a sensor to trigger off of.
So currently, your trigger will only trigger off of changes to the following entities: input_number.bedroomfan_timer_minutes, input_number.bedroomfan_timer_hours, and switch.sonoff__room_fan.
If you want this to trigger at any time in the day, you need to add the following sensor to home assistant and replace the now() method with that sensor:
Here is an example of a template that uses the time properly to update: