Home Assistant: Pause cooling when the door is open

A big heat wave has hit Finland lately and it’s been quite hot for the last couple of weeks. That got me wondering about energy usage of the A/C.

Quite often we are hanging out on our terrace and the backdoor is open. However, I don’t want to cool the outdoor air and waste energy for that. That got me an idea, how about shutting down the A/C unit when the door is open and continue cooling when the door is closed again?

Oh, and of course it should work also on winter when heating is on. I don’t want to heat the outdoor air either 🙂

Required components

For this automation only two components are required: A/C unit that can be controlled through Home Assistant and a magnetic door sensor.

I have a Mitsubishi FH35 A/C unit that has custom made MQTT network controller and a Xiaomi Aqara door/window sensor that is connected to Home Assistant through ZigBee network.

Automation

The automation logic is pretty simple:

When the door opens:

  1. If backdoor state is changed from ‘off’ to ‘on’ for 3 minutes (I don’t want to turn off the A/C immediately if someone is just visiting the terrace and closing the door immediately)
  2. If A/C unit state is something else than ‘None’
  3. Take a snapshot scene of A/C unit
  4. Turn off the A/C unit

When the door closes:

  1. Restore the scene that was previously stored.

Bonus: Ready made automations

Here are the automation scripts I wrote. Of course, you need to modify those at least with your entity ids.

- id: '1625563681954'
  alias: 'Climate: Turn off A/C when back door is open'
  description: 'Turn off A/C when back door is open'
  trigger:
  - platform: state
    entity_id: binary_sensor.door_sensor_terrace
    from: 'off'
    to: 'on'
    for: 00:03:00
  condition: []
  action:
  - service: scene.create
    data:
      snapshot_entities: climate.heat_pump
      scene_id: heat_pump_previous_state
  - service: climate.set_hvac_mode
    target:
      entity_id: climate.heat_pump
    data:
      hvac_mode: 'off'
  mode: single

- id: '1625563856240'
  alias: 'Climate: Restore A/C when backdoor is closed'
  description: 'Restore A/C when backdoor is closed'
  trigger:
  - platform: state
    entity_id: binary_sensor.door_sensor_terrace
    from: 'on'
    to: 'off'
  condition: []
  action:
  - scene: scene.heat_pump_previous_state
  mode: single

Leave a Reply

Your email address will not be published. Required fields are marked *