Is my laundry door open?

Friday, April 3rd, 2020 at 9:46 pm

On days when it is cold enough for my central heating to be needed in the morning but then it warms up for the afternoon I will leave my laundry door (and sometimes the front door) open (there are screen doors as well) to allow for plenty of fresh air. However I didn’t want the central heating to come on while the door was open as that would be a waste of energy.

Before I hooked my heating into my home automation I acheived this by flicking the HEAT/OFF switch on the thermostat, and for the initial implementation of my Arduino based controller it was easy to disconnect the relay was it was only connected with an alligator clip. However I recently mounted this controller to the wall in a more permanent way:

I couldn’t just pull the power on it as I still wanted the temperature readings, and altering the schedule in Google Calendar wasn’t that convenient, so with all the extra time I am now spending at home I decided to implement one of the things from my todo list: a sensor on the back door.

Some time back I had picked up some magnetic reed switches (like used in an alarm system) and it was straightforward to connect that up to one of the digital inputs on the D1 mini to read the state. It was a little bit more work to work out what and when to sent MQTT messages but that was easy to reverse engineer from the MQTT Binary Sensor config for Home Assistant.

I could now stand at the door with my phone, opening and closing it, and seeing the state change in the Home Assistant interface.

Though knowing if the door is open is only one part of the puzzle, I need to interact with the thermostat component.

I had two automations to drive the thermostat from the calendar:

  • when a heating event starts THEN turn on the thermostat component and set the target temperature
  • when a heating event ends THEN turn off the component and set the target temperature to zero

I altered these and added new automations to end up with:

  • when heating event starts AND door is closed THEN turn on thermostat
  • if door open for 5 minutes AND thermostat is on THEN turn off thermostat
  • if door closed for 5 minutes AND thermostat off AND during heating event THEN turn on thermostat
  • when heating event ends THEN turn off thermostat

This seems to be working. I put in the 5 minutes condition as I only want it to be when I have deliberately left the door open, not if I open it briefly, eg to put something in the bin. I think I might be able to combine the automations into only two, but I will leave that for later.

I also plan to have a proper outdoor temperature sensor so that I can have it notify me if the temperature is dropping and I have left the door open, or also if the temperature has risen enough that I might want to open the door.

But first I will cross a different item off my todo list, one that involves two microswitches and my garage door…

Tagged with: