diff --git a/MqttTopics.h b/MqttTopics.h index 82f55c5..42e052d 100644 --- a/MqttTopics.h +++ b/MqttTopics.h @@ -22,5 +22,6 @@ #define mqtt_topic_config_led_brightness "/configuration/ledBrightness" #define mqtt_topic_config_auto_unlock "/configuration/autoUnlock" #define mqtt_topic_config_auto_lock "/configuration/autoLock" +#define mqtt_topic_config_single_lock "/configuration/singleLock" #define mqtt_topic_presence "/presence/devices" diff --git a/NetworkLock.cpp b/NetworkLock.cpp index e6246be..e5971ae 100644 --- a/NetworkLock.cpp +++ b/NetworkLock.cpp @@ -15,6 +15,7 @@ NetworkLock::NetworkLock(Network* network, Preferences* preferences) _configTopics.push_back(mqtt_topic_config_led_brightness); _configTopics.push_back(mqtt_topic_config_auto_unlock); _configTopics.push_back(mqtt_topic_config_auto_lock); + _configTopics.push_back(mqtt_topic_config_single_lock); _network->registerMqttReceiver(this); } @@ -156,6 +157,7 @@ void NetworkLock::publishConfig(const NukiLock::Config &config) publishBool(mqtt_topic_config_button_enabled, config.buttonEnabled == 1); publishBool(mqtt_topic_config_led_enabled, config.ledEnabled == 1); publishInt(mqtt_topic_config_led_brightness, config.ledBrightness); + publishBool(mqtt_topic_config_single_lock, config.singleLock == 1); } void NetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &config) diff --git a/NukiWrapper.cpp b/NukiWrapper.cpp index 0232376..5dad116 100644 --- a/NukiWrapper.cpp +++ b/NukiWrapper.cpp @@ -281,6 +281,13 @@ void NukiWrapper::onConfigUpdateReceived(const char *topic, const char *value) _nukiLock.setLedBrightness(newValue); _nextConfigUpdateTs = millis() + 300; } + if(strcmp(topic, mqtt_topic_config_single_lock) == 0) + { + bool newValue = atoi(value) > 0; + if(!_nukiConfigValid || _nukiConfig.singleLock == newValue) return; + _nukiLock.enableSingleLock(newValue); + _nextConfigUpdateTs = millis() + 300; + } else if(strcmp(topic, mqtt_topic_config_auto_unlock) == 0) { bool newValue = !(atoi(value) > 0); diff --git a/README.md b/README.md index 11fd75b..70ac0d0 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Just enable pairing mode on the NUKI lock (press button for a few seconds) and p ## Support If you haven't ordered your NUKI product yet, you can support me by using my referrer code when placing your order:
-REFN8VHZXUBV4
+REFSHC6Z6QZ4P
This will also give you a 30€ discount for your order. ## MQTT Interface