How technyon/nuki_hub works
Nuki Hub is ESP32 firmware that bridges Nuki locks, openers, and keypads to local home-automation systems. Its principal workflow is to initialize network and device services, communicate with Nuki devices over BLE, then expose state and accept commands through MQTT; users can also configure the hub through its web interface and GPIO. The graph preserves documented capabilities such as Ethernet, Home Assistant discovery, and import/export. Source excerpts are partial, so some subsystem links are based on README statements rather than inspected call sites.
Main entry points: main.cpp Hub runtime · WebCfgServer.h Web configuration · NukiNetwork.cpp Network manager · BleScanner.cpp BLE scanning
Components 31
Firmware runtime
- Hub runtime
src/main.cpp - Preferences
src/PreferencesKeys.h - Logging
src/Logger.h - Timing utility
src/EspMillis.h - Restart reasons
src/RestartReason.h
Nuki devices
- BLE scanning
lib/BleScanner/src/BleScanner.cpp - Lock protocol
src/NukiNetworkLock.cpp - Opener protocol
src/NukiNetworkOpener.cpp - Device wrapper
src/NukiWrapper.h - Opener wrapper
src/NukiOpenerWrapper.h
Network connectivity
- Network manager
src/NukiNetwork.cpp - Wi-Fi device
src/networkDevices/WifiDevice.cpp - Ethernet device
src/networkDevices/EthernetDevice.cpp
Home automation
- MQTT client
lib/espMqttClient/src/MqttClient.cpp - MQTT transport
lib/espMqttClient/src/Transport/Transport.h - MQTT topics
src/MqttTopics.h - Command receiver
src/MqttReceiver.h - State publisher
src/NukiPublisher.cpp - HA discovery
src/HomeAssistantDiscovery.cpp - MQTT logging
lib/espMqttClient/src/Logging.h
Configuration and control
- GPIO control
src/Gpio.h - Web configuration
src/WebCfgServer.h - HTTP server
lib/PsychicHttp/src/PsychicHttpServer.h - Import and export
src/ImportExport.cpp - Duo authentication
lib/DuoAuthLibrary/src/DuoAuthLib.cpp - HTTP core
lib/PsychicHttp/src/PsychicCore.h - HTTP requests
lib/PsychicHttp/src/PsychicRequest.h
Other components
- Home automation user
- Nuki device
- Home automation
- MQTT broker
Connections 38
- Home automation user → Hub runtime: configures
- Hub runtime → Network manager: initializes
src/main.cpp - Hub runtime → Device wrapper: starts device
src/main.cpp - Hub runtime → Lock protocol: starts lock
src/main.cpp - Hub runtime → Opener wrapper: starts opener
src/main.cpp - Hub runtime → GPIO control: configures
src/main.cpp - Hub runtime → Web configuration: starts server
src/main.cpp - Hub runtime → Import and export: uses
src/main.cpp - Hub runtime → Preferences: uses
src/main.cpp - Hub runtime → Restart reasons: uses
src/main.cpp - Hub runtime → BLE scanning: discovers devices
- Nuki device → BLE scanning: advertises
- BLE scanning → Lock protocol: communicates over BLE
- BLE scanning → Opener protocol: communicates over BLE
- Device wrapper → Lock protocol: controls
- Opener wrapper → Opener protocol: controls
- Network manager → Wi-Fi device: selects interface
- Network manager → Ethernet device: selects interface
- Hub runtime → MQTT client: integrates MQTT
- MQTT client → MQTT transport: uses transport
- MQTT client → MQTT broker: publishes and subscribes
- Command receiver → MQTT topics: uses topics
- State publisher → MQTT topics: uses topics
- Command receiver → Lock protocol: accepts commands
- Command receiver → Opener protocol: accepts commands
- State publisher → MQTT broker: publishes state
- Home automation → MQTT broker: exchanges messages
- HA discovery → Home automation: announces devices
- Home automation user → Web configuration: configures
- Web configuration → HTTP server: serves through
- HTTP server → HTTP core: uses
- HTTP requests → HTTP core: uses
lib/PsychicHttp/src/PsychicHandler.h - Hub runtime → Logging: uses
src/main.cpp - Logging → MQTT logging: uses
src/Logger.h - Hub runtime → Timing utility: uses
src/main.cpp - Web configuration → Import and export: supports configuration transfer
- Web configuration → Duo authentication: optional authentication
- Network manager → MQTT client: provides connectivity