Adding a simple wifi momentary switch for manual door-lock position

I have two manual sliding-glass door-locks that the kids continue to leave un-locked and I would like to see at a glance on my HA dashboard if the locks are in place or not. My thought is to create a simple moment switch that the locks depress when in place and an ESPHome wifi module to send the signal to Home Assistant to inform if the switch is depressed or not. My thought is to use a D1 mini as my ESPHome Wifi module and then just wire up a momentary switch that is either on or off based on whether or not the lock is depressed or not. Does anyone have any thoughts on this?? I am new to HA and new to ESPHome. From what I can tell it looks like it would work, but I don’t know what coding I will need to flash to the D1 for this nor do I know where to get documentation. I am happy to research if someone can point me in the right direction.

Got a picture of the locks?

Often a thoughtfully placed reed switch / door sensor can serve many purposes.

And often something like a Aqara one might be better than an ESP as they are small, discreet and wireless.

You can hack then with other sensors too. Take a look at the door lock sensor for example.

1 Like

I have attached a picture of what my locks basically look like, only mine have a bit more space to hide a sensor between the recesses for the sliding bolt.

I just received two Shelly door sensors I orderd and decided to take a look at them as well. . . I think they might work also. I have attached pics. It looks like the board has places i could solder wires to a momentary switch. But I don’t know which ones to use. I’m assuming one of the GND locations for the ground but would I use the esp 3.3v for the other side of the switch?


One part of the door sensor should just be a magnet. This magnet can be replaced with a smaller one(like below).

I would definitely investigate if a smaller one could be say super glued to the bottom of the metal pin and then the other part of the reed switch positioned on the outside or inside of the recess.

You can also probably buy and wire up your own reed switch to your Shelly or Aqara etc if its easier to fit the sensor in the tight space and have the casing/electronics elsewhere.

You could also look at the battery terminal approach (metal arm makes contact) or find an endstop (basically a momentary switch).

Not sure about the Shelly wiring - can you trace what the reed switch is connected to? Maybe find docs…