HomeBridge – Door Lock

It has been a while sins I made a module for my HomeBridge, now I wanted to see if I could make a door lock. First, you must install HomeBridge on a Raspberry Pi, and configure it as a HomeKit bridge device.How to do that, you can read here. Then I need a door lock, so I found these here below.

Cabinet Door Lock

Applied to the cabinet lock, locker locks, file cabinet locks ,etc. Designed with the open frame type and mount board, high power Easy to install for the electric door lock or other automatic door lock systems with the mounting board. Voltage: 12VDC, Current: 0.35A, Size:54*41mm (L*W).

Installing the Plugin on your HomeBridge

When you have installed the HomeBridge you need to install the Homebridge-lock package in order to let the HomeBridge communicate with your ESP8266 over http.

sudonpminstall-ghomebridge-lock--unsafe-perm

Edit the HomeBridge /var/homebridge/config.json file on the Raspberry Pi HomeBridge. the file may alternatively be in /home/.homebridge or /root/home/./homebridge.

sudo nano ~/.homebridge/config.json

Add this code to the config.json file. Mind the last comma, you may or may not need it if you have other accessories, or Homebridge is crashing on load.

{"bridge":{"name":"Homebridge","username":"CC:22:3D:E3:CE:30","port":51826,"pin":"031-45-154"},"description":"This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.","accessories":[{"accessory":"HTTPLock","name":"Door","url":"http://192.168.1.10/","lock-id":"1","username":"username","password":"password"}]}

The Hardware

Now we can make our setup so we can see if everything is working. In the Fritzing diagram below you can see that now I have added a door lock plus a external power supply 5V 1A. We are keeping the RX and TX connected so we can see in the monitor from the Arduino IDE if everything is working as we want to.

Now we have to connect our iPhone to the home bridge and add the new accesoires.

Hooray! It works!

Download all Files for this project on github.

Do you have any questions? Leave a comment down here.

Reference

Nick Farina (Nov 14 2017), Homebridge, Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API., https://github.com/nfarina/homebridge Volca ( Jul 18 2017), EspLock Plugin, This plugin supports locks controlled by any custom HTTP endpoint via GET (to get state, either “locked” or “unlocked”), and POST (to set new state, same two values), https://github.com/volca/homebridge-esplock

Donate

Since October 2015, StudioPieters® has been writing this blog. Help accelerate its development with a small contribution! StudioPieters® is open source, and 100% free . Please consider donating to StudioPieters® before starting the fun of building and learning. StudioPieters® is a non-profit organisation devoted to making creative use of electronics accessible to everyone.