Automation: If HVAC temp is between 18-21 do X

Hello,

I’m trying to achieve the following

When the HVAC is on, and if the current temperature is between 18-21 degree Celsius, automatically set the temperature to 22.

The reason I want to do this is because one of my kid keeps decreasing the temperature to 18 and the other one feels too cold and is more comfortable around 22 degree.

I’m using a BroadLink IR along with Smart IR add on. I know I probably have to create a template but I’m not good with it. Can someone offer help?

Templates should not be required for this. Just use a numeric state trigger monitoring the temperature and use a state condition to check if the HVAC is on.

Thank you. I did not know something like numeric state trigger existed. You are a live safer.