I have a LOQED Touch Smart Lock and used the built-in LOQED integration for a while. It works, but a few things kept bothering me:
- With a Home Assistant Cloud subscription, the integration registers a Nabu Casa URL on the bridge. So every lock event goes from my hallway to the internet and back, even though the bridge and Home Assistant are on the same network.
- There are no events. The bridge reports every lock action, but the integration only uses it to update the lock state, so there’s nothing to trigger an automation on except a state change.
- You can’t tell how the lock was used. Was it the PIN on the outside module, a phone over Bluetooth, the app, a twist of the knob? The integration only shows
KeyID 3. - When I press Lock, Home Assistant sends the command and moves on. The bridge answers “OK” to every command, even one the lock will reject. I had no way to know if the door actually locked.
- If the bridge can’t be reached (a new IP, a VLAN/Firewall rule, Wi-Fi issues), the lock is just unavailable. LOQED’s cloud could still control it, but nothing uses it.
- The integration doesn’t poll. If the bridge loses a webhook, which happens now and then, the state stays wrong until the next event.
So I wrote a gateway that sits between the lock and MQTT. It runs as a Home Assistant add-on, and each lock shows up as a device through MQTT discovery.
What it does
- Local first, cloud as fallback. It talks to the bridge on your network. If the bridge stops answering, it switches to the LOQED cloud and goes back when the bridge is reachable again. LOQED blocks accounts that read the status more than 12 times in 12 hours, so the gateway keeps a budget for cloud calls and stays under that limit, even across restarts.
- Commands are confirmed. A command counts as done only when the lock reports that it reached the target. If the bridge can’t be reached, the command is retried, then sent once through the cloud. A command the bridge may already have received is never sent again, so
OPENcan’t unlatch the door twice. A Last command sensor shows the result (confirmed, failed and why, expired), and failures also fire acommand_failedevent you can notify on. - No webhook address to set up. For each bridge, the gateway asks the OS which of its own addresses that bridge can reach, and registers its webhook there. This works with VLANs and several network cards. If the host gets a new IP, the gateway moves its registration on the bridge.
- Checks that events actually arrive. If the bridge can’t reach the gateway (a typical firewall problem with IoT VLANs), the log tells you which address and port to allow, and the gateway reads the lock status every minute until it’s fixed. When the state may be out of date, a
state_staleflag says so. - More details. Lock events with the key that was used (you can name your keys), the last change reason, battery level and voltage, Wi-Fi and Bluetooth signal, connection mode, and token expiry.
- Bridge webhook list. Old webhooks on the bridge slow down every event, because the bridge calls them one after another. A diagnostic sensor lists them, and you can clean them up over MQTT (opt-in).
- Less to maintain. One add-on handles every lock on the account. A new bridge IP or new keys are picked up from LOQED’s API. If you give it your LOQED email and password instead of a token, it renews the token itself.
Not only for Home Assistant
The gateway is a plain MQTT service. There’s a Docker image (amd64, arm64, arm/v7) for any host, and Node-RED, openHAB or your own scripts can use the topics: state, events, commands, and command status with an optional id to match each command to its result. Home Assistant discovery is just one part of it. The LOQED client code is also usable on its own as a Go library.
Things to know
- You need an MQTT broker (the Mosquitto add-on is fine).
- Use the gateway or the built-in integration for a lock, not both. Each one adds a webhook to the bridge, and every extra webhook delays events.
- In cloud mode without cloud webhooks, the state can be more than an hour old because of LOQED’s limit. Cloud webhooks fix that, and can be set up with a reverse proxy or a Home Assistant Cloud webhook (the docs have the automation).
- The add-on runs on amd64 and aarch64.
- This is a young project (0.2.0), and I’ve tested it on my own lock. Bug reports are very welcome.
- Not affiliated with LOQED.
Install
Or add https://github.com/t3hk0d3/go-loqed in the add-on store, install LOQED MQTT Gateway, set a personal access token from Laravel (or your LOQED email and password), and start it. The add-on’s Documentation tab covers every option.
Sources and documentation: GitHub - t3hk0d3/go-loqed: HTTP Client for LOQED local bride API · GitHub
