Introduction
A relative told me that 2 years ago he had a lock of this type, in that case, a remock locker:
And 1 month ago we set up home assistant in his house, so he wanted to control this lock from home assistant
These kind of latch are so simple to use, and (in my opinion) they are a really good solution for securing your door because they are invisible.
In the case of remock, they have an optional “hub” which costs around 60€ and you’ll get the lock working with the manufacturer app…
But… we want to manage this kind of locker with Home Assistant, isn’t it?
How to do it
First of all, the first thing I did was look for documentation on this type of lock, the protocols used for the connection between the controls and the lock, and how to “hack” it with an ESP8266 and some RFID module.
Unfortunately, these locks use specific protocols such as “rolling code”, which are quite complex to “hack” and we could have synchronization problems… etc.
But, the good news is that these locks include several remote controls, and obviously these remotes have switches, and of course, there is a type of component that allows us to activate a switch with arduino/ESP… the relays.
TL/DR, Let’s start, parts required
- A remote of the lock
- ESP8266/Nodemcu/ESP32
- 3xRelays
- Tin
- AWG30 wires
- Some dupont wires
The schematics
The schematics are so simple. Please, I already know that there are better options for handling switches, like SSR… but I built this project with the things I have now in my home
Please, in order to “attach” the AWG30 to the relay, just include a little of tin on the end
The ESPHOME code
Ok, at this time, we must create the ESPHOME yaml code, which so simple, we have 3 relays, so we have 3 switches:
esphome:
name: esphome-remock # the name of the esp
esp8266:
board: nodemcuv2 # Select your board
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "YOUR_API_KEY"
ota:
password: "PASSWORD_OTA"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "FALLBACK_HOTSPOT"
password: "FALLBACK_PASS"
captive_portal:
light:
- platform: status_led
name: "Change LED status"
pin:
number: GPIO2
inverted: true
switch:
- platform: gpio
pin: D3
name: "Bloquear cerradura" # Close (or lock xD) the latch
id: close_relay
restore_mode: always off
- platform: gpio
pin: D6
name: "Abrir cerradura" # Open the latch
id: open_relay
restore_mode: always off
- platform: gpio
pin: D5
name: "Apertura de emergencia" # Emergency open
id: emergency_relay
restore_mode: always off
Home Assistant scripts
Ok, we will active the relay, then wait for 0,2s (simulating a “user click”) and then, switch it of. To do this, we just need to create 3 scripts like this:
alias: Abrir la cerradura
sequence:
- type: turn_on
device_id: "YOUR_DEVICE_ID"
entity_id: switch.abrir_cerradura
domain: switch
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- type: turn_off
device_id: "YOUR_DEVICE_ID"
entity_id: switch.abrir_cerradura
domain: switch
mode: single
icon: mdi:door-closed
Then, you can just add a card to lovelace:
type: entities
entities:
- entity: script.open_door
- entity: script.block_door
- entity: script.emergency_door
title: Cerradura
state_color: false
Summary picture (without relay connections)
Bonus track, 3d printing a case
Ok but… we don’t want to have these wires on top of a table, so… it’s time to open Fusion 360 and design a case!!!
These are the 3MF files for this project
Demo time!! How does it works??
This is the final stage of the project:
BONUS TRACK: Block the door when you leave home:
With automations… it’s easy to do this
alias: Block the door when all of use leave the home
description: ""
trigger:
- platform: zone
entity_id: device_tracker.DEVICE_1
zone: zone.home
event: leave
action:
- service: script.block_door
data: {}
- service: notify.telegram
data:
message: "The door has been closed"
mode: single