make single lock configurable
This commit is contained in:
@@ -22,5 +22,6 @@
|
|||||||
#define mqtt_topic_config_led_brightness "/configuration/ledBrightness"
|
#define mqtt_topic_config_led_brightness "/configuration/ledBrightness"
|
||||||
#define mqtt_topic_config_auto_unlock "/configuration/autoUnlock"
|
#define mqtt_topic_config_auto_unlock "/configuration/autoUnlock"
|
||||||
#define mqtt_topic_config_auto_lock "/configuration/autoLock"
|
#define mqtt_topic_config_auto_lock "/configuration/autoLock"
|
||||||
|
#define mqtt_topic_config_single_lock "/configuration/singleLock"
|
||||||
|
|
||||||
#define mqtt_topic_presence "/presence/devices"
|
#define mqtt_topic_presence "/presence/devices"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ NetworkLock::NetworkLock(Network* network, Preferences* preferences)
|
|||||||
_configTopics.push_back(mqtt_topic_config_led_brightness);
|
_configTopics.push_back(mqtt_topic_config_led_brightness);
|
||||||
_configTopics.push_back(mqtt_topic_config_auto_unlock);
|
_configTopics.push_back(mqtt_topic_config_auto_unlock);
|
||||||
_configTopics.push_back(mqtt_topic_config_auto_lock);
|
_configTopics.push_back(mqtt_topic_config_auto_lock);
|
||||||
|
_configTopics.push_back(mqtt_topic_config_single_lock);
|
||||||
|
|
||||||
_network->registerMqttReceiver(this);
|
_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_button_enabled, config.buttonEnabled == 1);
|
||||||
publishBool(mqtt_topic_config_led_enabled, config.ledEnabled == 1);
|
publishBool(mqtt_topic_config_led_enabled, config.ledEnabled == 1);
|
||||||
publishInt(mqtt_topic_config_led_brightness, config.ledBrightness);
|
publishInt(mqtt_topic_config_led_brightness, config.ledBrightness);
|
||||||
|
publishBool(mqtt_topic_config_single_lock, config.singleLock == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &config)
|
void NetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &config)
|
||||||
|
|||||||
@@ -281,6 +281,13 @@ void NukiWrapper::onConfigUpdateReceived(const char *topic, const char *value)
|
|||||||
_nukiLock.setLedBrightness(newValue);
|
_nukiLock.setLedBrightness(newValue);
|
||||||
_nextConfigUpdateTs = millis() + 300;
|
_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)
|
else if(strcmp(topic, mqtt_topic_config_auto_unlock) == 0)
|
||||||
{
|
{
|
||||||
bool newValue = !(atoi(value) > 0);
|
bool newValue = !(atoi(value) > 0);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ Just enable pairing mode on the NUKI lock (press button for a few seconds) and p
|
|||||||
## Support
|
## Support
|
||||||
|
|
||||||
If you haven't ordered your NUKI product yet, you can support me by using my referrer code when placing your order:<br>
|
If you haven't ordered your NUKI product yet, you can support me by using my referrer code when placing your order:<br>
|
||||||
REFN8VHZXUBV4<br>
|
REFSHC6Z6QZ4P<br>
|
||||||
This will also give you a 30€ discount for your order.
|
This will also give you a 30€ discount for your order.
|
||||||
|
|
||||||
## MQTT Interface
|
## MQTT Interface
|
||||||
|
|||||||
Reference in New Issue
Block a user