⚠️ Compatibility Notice
This bot works ONLY with RaspiNukiBridge.
It does not support the official Nuki Bridge HTTP API.
Nuki Telegram Bot is a self-hosted Telegram bot that lets you control a Nuki Smart Lock through RaspiNukiBridge (running for example on a Raspberry Pi).
It is designed to be simple, secure, production-ready and privacy-friendly.
Main features include:
- Self-hosting support (Raspberry Pi / VPS / Home Server)
- Per-user permissions (lock, unlock, open, lock’n’go, status)
- Admin UI with inline keyboards
- Multi-language support (IT/EN)
- Secure door-unlatch confirmation
.env-based configuration- systemd-friendly execution
/startto display main keyboard + permissions summary/idto show your chat ID- Inline UI for:
- Lock / Unlock
- Open (unlatch) with confirmation
- Lock’n’Go
- Lock status
- Language switch (IT/EN)
Each user can independently choose their UI language.
Admins are Telegram chat IDs listed in the OWNERS variable.
Admins can:
- Add new users interactively
- List existing users
- Grant/Revoke individual permissions
- Grant/Revoke all permissions
- Delete users
- Always override all permissions
Permission keys (English only):
lockunlockopenlockngostatus
This bot is compatible only with RaspiNukiBridge.
It cannot communicate with the official Nuki Bridge API.
You must have RaspiNukiBridge running and accessible.
The bot communicates exclusively with it.
main.py– Entrypoint, loads config and users, initializes Telegram botconfig.py– Loads config into a dataclassusers.py– Handlesusers.jsonand permission logicnuki.py– Wrapper around RaspiNukiBridge endpointsbot_handlers.py– Commands, callbacks, inline keyboardsi18n.py– Simple runtime translation (English + Italian)
Runtime user data is stored in users.json.
- Python 3.10+
- A Nuki Smart Lock managed through RaspiNukiBridge
- A Telegram bot token (
BotFather)
Install requirements:
pip install -r requirements.txtVirtual environment recommended:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtgit clone https://github.com/lmerega/nuki_telegram_bot
cd nuki_telegram_bot
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtThe bot reads config from environment variables.
Use a local .env file for development or a systemd EnvironmentFile in production.
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
NUKI_TOKEN=your_raspinukibridge_token_here
NUKI_BRIDGE_HOST=192.168.1.50
NUKI_BRIDGE_PORT=8080
NUKI_ID=123456789
NUKI_DEVICE_TYPE=0
OWNERS=123456789,987654321
USERS_FILE=/srv/nuki_telegram_bot/users.jsonExample:
{
"users": {
"123456789": {
"name": "John Doe",
"allowed": ["lock", "unlock", "open", "lockngo", "status"],
"lang": "en"
},
"987654321": {
"name": "Mario Rossi",
"allowed": ["lock", "status"],
"lang": "it"
}
}
}source .venv/bin/activate
python main.pySend /start to your bot on Telegram.
/start,/id- Inline controls for the lock
- Language selection
- Add users
- Manage permissions
- Delete users
- View user list
Admins bypass all permission restrictions.
Example service file:
[Unit]
Description=Nuki Telegram Bot
After=network.target
[Service]
WorkingDirectory=/srv/nuki_telegram_bot
ExecStart=/srv/nuki_telegram_bot/.venv/bin/python /srv/nuki_telegram_bot/main.py
EnvironmentFile=/srv/nuki_telegram_bot/.env
Restart=always
RestartSec=5
#User=nuki
[Install]
WantedBy=multi-user.targetEnable:
sudo systemctl daemon-reload
sudo systemctl enable nuki-bot.service
sudo systemctl start nuki-bot.service- Never commit
.envorusers.json - Use a dedicated system user
- Restrict access to RaspiNukiBridge
- Unlatch confirmation requires one-time token
- Keep system updated
- Translations stored in
i18n.py - Code split into clear modules
- Keep permissions in English internally
- PRs welcome
Does it support the official Nuki Bridge API?
No, only RaspiNukiBridge.
Can I run it remotely (VPS)?
Yes, if it can reach RaspiNukiBridge (VPN recommended).
Multiple locks?
Not yet; requires code extension.
What if users.json is deleted?
Admins can recreate everything.
MIT License.
See LICENSE.
