Looking for a DIY cheap drop pin door lock? Read on. Magnetic door locks would also work.
I have 3 outside doors in my home. I have added a $200 keypad Z-Wave door lock on one of the doors, but still had to walk around the house every night to lock the other 2. I am not willing to spend another $400 to e-lock the other doors, as I consider that to be silly!
So, What to do?
I came across these on Amazon for $24.
(https://www.amazon.com/LIBO-Electric-Electronic-Control-Security/dp/B07DW17J3Q 233)
This is a drop pin lock that locks under power and unlocks when no power. They also have a reed switch output so you can sense if the door is open or not. I bought 2! Here’s how I integrated them.
I used a Sonoff SV as the WIFI connection. Found a nice wood box and switch. Then I came up with a couple of 20v 3amp power supplies from failed Dell laptops. I had all this laying in the project boxes so free to me. I flashed the SV’s and mounted them in the box. Mounted the switch, drilled holes for the wires. That was all set.
I opened the lock and looked at what was there. There is a circuit board with a delay timer and 2 reed switches. One reed switch is for controlling when the lock pin is allowed to pop out. The other one just goes to the wires that the Amazon ad says are ‘useless’. When the mating side of the lock comes close to the brain side it has a magnet and flips the reed switches. On the circuit board there are both NO and NC connections to the second reed switch, so you can pick either for your situation.
I’m not someone that can draw this out for a nice circuit diagram, so here’s how I wired it in word form:
- 20v power in to power in on the SV
- Power out on the SV to the lock solenoid wires
- Reed switch common to GPIO5 Ground
- Reed switch NC to GPIO5 Signal
- 10k resistor from GPIO5 VCC to Signal (pullup just in case)
- GPIO14 Signal and Ground to NO push button switch
Then the programming.
TASMOTA Code:
I set-up this template to configure the switches.
{"NAME":"Lock_SV","GPIO":[0,1,0,1,225,161,0,0,224,321,160,0,0,1],"FLAG":0,"BASE":3}
This gets the button, the switch, the relay and pseudo relay for the door sensor set-up.
Then I load these backlog commands. You need your own SSID and WIFI stuff and some of the options are choices, but this fits my situation:
Copy to clipboard
Backlog SSID1 SSIDHere; Password1 WIFIPasswordHere; MqttHost Your.IP.goes.Here; MqttUser YourMQTTUserName; MqttPassword YourMQTTPassword; Hostname SideLock; MqttClient SideLock; Topic SideLock
Backlog FullTopic %topic%/%prefix%/; FriendlyName1 SideLock; SysLog 2; WebLog 2; MQTTlog 2; SerialLog 0; SwitchMode2 1
Backlog rule1 on POWER1#state=1 do PUBLISH2 FrontLock/stat/lock LOCKED endon on POWER1#state=0 do PUBLISH2 FrontLock/stat/lock UNLOCKED endon on POWER2#state=1 do PUBLISH2 FrontLock/stat/door OPEN endon on POWER2#state=0 do PUBLISH2 FrontLock/stat/door CLOSED endon on event#LOCK do POWER1 1 on endon on event#UNLOCK do POWER1 0 endon
All the churn is needed because the SV uses ON and OFF states, and the HA and the Google expects lock entitys to be LOCK or UNLOCK. PUBLISH2 is to retain the lock and door status thru HA reboots, as opposed to PUBLISH. Also I flip my topics around because I like them that way. That is optional, but you will need to flip the topic in all the code below if you choose to not do FullTopic %topic%/%prefix%/
…
HOME ASSISTANT Code:
Here’s the MQTT lock YAML using the topics in the above backlog commands:
Copy to clipboard
lock:
- platform: mqtt
name: "Side Door Lock"
unique_id: 84912be5-26f5-460e-bae7-34541520430b
state_topic: "SideLock/stat/lock"
command_topic: "SideLock/cmnd/EVENT"
availability_topic: "SideLock/tele/LWT"
qos: 1
retain: true
state_locked: LOCKED
state_unlocked: UNLOCKED
payload_available: "Online"
payload_not_available: "Offline"
Here’s the Binary Sensor YAML for the door sensor:
Copy to clipboard
binary_sensor:
- platform: mqtt
name: "Side Door Open"
unique_id: dbb35f4f-a3ec-443c-ac6f-4cfb31b0cdd0
device_class: door
state_topic: SideLock/stat/door
payload_on: 'OPEN'
payload_off: 'CLOSED'
force_update: false
availability_topic: "SideLock/tele/LWT"
payload_available: Online
payload_not_available: Offline
The drawback to this system is there is no external access to unlock these 2 doors. I don’t really care because the Z-Wave lock has keypad, hard key, and WIFI access to unlock it, so when we come home we just come in that door. Yes they pull a little power when on, but I’ll take that. You could easily rig up a keypad or RFID or fingerprint reader or whatever to access from the outside because GPIO4 is sitting there unused. In my case I did build a keypad based on a sonoff remote and the RF433 radios I already had in my system. See here:
https://whatarewefixing.today/758/5-button-keypad-cipher-lock-blueprint-using-trigger-id/
After a couple of years, one of the Sonoff-SV’s failed. By that time I had Zigbee radios around the house so I wanted to try one of these doors with that. It was actually easier to do, but the sensor and the switch and the Push Button are all 3 separate items, 2 of them with batteries. If you want to know more about that contact me on Discord or watch this space for updates.
I hope this helps you. If You have any suggestions or want to add to this please feel free.
Thank-You for reading!
What are we Fixing Today Homepage / Website:
https://www.WhatAreWeFixing.Today/
Channel Link URL: (WhatAreWeFixingToday)
https://bit.ly/WhatAreWeFixingTodaysYT
What are we Fixing Today Facebook page (Sir GoodEnough):
https://bit.ly/WhatAreWeFixingTodaybFB
What are we Fixing Today Twitter Account (Sir GoodEnough):
https://bit.ly/WhatAreWeFixingTodayTW
Discord Account: (Sir_Goodenough#9683)
https://discord.gg/Uhmhu3B
Patreon: https://www.patreon.com/WhatAreWeFixingToday
Buy me Coffee: https://www.buymeacoffee.com/SirGoodenough
PayPal one-off donation link: https://www.paypal.me/SirGoodenough
Cash App $CASHTAG: https://cash.me/$SirGoodenough
Venmo cash link: https://venmo.com/SirGoodenough
If you would like to donate anything to this channel, please use this address:
C/O: Sirius GoodEnough
322 Buena Vista Ave.
Department: DYT
Waukesha, Wisconsin, 53188-3602