Fire an automation if a blocking condition changes

Wondering how to do this. I recently added a tasmota relay to my baseboard heaters in the basement. They turn on and off based on a zigbee temperature sensor in the room. Works great.

Today it’s beautiful and it’s 67 degrees out outside right now. I opened the back door (which has a door contact sensor on it). The temp in the room dropped, because I want to enjoy the fresh air, however, the baseboard heaters kicked on.

I thought to add a condition “Only if the basement sliding glass door is closed”. However, I made some binary input sensors to test this, and if a condition that blocks an automation changes (the door closes) the automation won’t trigger again. And this is a bad scenario: Say I have the temp trigger set to 67 degrees, and it won’t turn on if the door is open. The room is 68. I open the door. Temp drops to 66… heaters don’t come on. I close the door. Now the heaters won’t come on ever again until the temp raises above 67.

Is there a cleaner way to run this automation other than to just have it constantly checking on a timer?

Instead of using an automation to control the heaters, use the Generic Thermostat integration. It will create a climate entity (like climate.basement).

Then create an automation that turns off climate.basement when the door is open and turns it on when the door is closed. When re-enabled, climate.basement will resume controlling the heaters (and turn them on if the temperature decreased while the doors were open). Obviously you can make the automation as clever as you wish (it can use additional factors to determine if and when climate.basement should be enabled/disabled).

Example:

- alias: Heating Override
  trigger:
  - platform: state
    entity_id: binary_sensor.door
  action:
  - service: "climate.turn_{{ 'off' if trigger.to_state.state == 'on' else 'on' }}"
    target:
      entity_id: climate.basement

Hmm, that’s pretty clever. I havent seen that Generic Thermostat integration before. I’ll check that out. Should give me the flexibility I need.

Because it creates a climate entity, you will also be able to display it in the UI with the Thermostat card.