diff --git a/NetworkLock.cpp b/NetworkLock.cpp index b8ad1f2..b4cca44 100644 --- a/NetworkLock.cpp +++ b/NetworkLock.cpp @@ -45,6 +45,7 @@ void NetworkLock::initialize() _haEnabled = _preferences->getString(preference_mqtt_hass_discovery) != ""; + _network->initTopic(_mqttPath, mqtt_topic_lock_action, "--"); _network->subscribe(_mqttPath, mqtt_topic_lock_action); for(const auto& topic : _configTopics) { @@ -88,7 +89,7 @@ void NetworkLock::onMqttDataReceived(char *&topic, byte *&payload, unsigned int if(comparePrefixedPath(topic, mqtt_topic_lock_action)) { - if(strcmp(value, "") == 0 || strcmp(value, "ack") == 0 || strcmp(value, "unknown_action") == 0) return; + if(strcmp(value, "") == 0 || strcmp(value, "--") == 0 || strcmp(value, "ack") == 0 || strcmp(value, "unknown_action") == 0) return; Serial.print(F("Lock action received: ")); Serial.println(value); @@ -104,13 +105,19 @@ void NetworkLock::onMqttDataReceived(char *&topic, byte *&payload, unsigned int { if(_keypadCommandReceivedReceivedCallback != nullptr) { + if(strcmp(value, "--") != 0) return; + _keypadCommandReceivedReceivedCallback(value, _keypadCommandId, _keypadCommandName, _keypadCommandCode, _keypadCommandEnabled); _keypadCommandId = 0; _keypadCommandName = "--"; _keypadCommandCode = "000000"; _keypadCommandEnabled = 1; - publishString(mqtt_topic_keypad_command_action, "--"); + + if(strcmp(value, "--") != 0) + { + publishString(mqtt_topic_keypad_command_action, "--"); + } publishInt(mqtt_topic_keypad_command_id, _keypadCommandId); publishString(mqtt_topic_keypad_command_name, _keypadCommandName.c_str()); publishString(mqtt_topic_keypad_command_code, _keypadCommandCode.c_str()); diff --git a/NetworkOpener.cpp b/NetworkOpener.cpp index 8b66239..4e76d14 100644 --- a/NetworkOpener.cpp +++ b/NetworkOpener.cpp @@ -36,6 +36,7 @@ void NetworkOpener::initialize() _haEnabled = _preferences->getString(preference_mqtt_hass_discovery) != ""; + _network->initTopic(_mqttPath, mqtt_topic_lock_action, "--"); _network->subscribe(_mqttPath, mqtt_topic_lock_action); for(const auto& topic : _configTopics) { @@ -67,7 +68,7 @@ void NetworkOpener::onMqttDataReceived(char *&topic, byte *&payload, unsigned in if(comparePrefixedPath(topic, mqtt_topic_lock_action)) { - if(strcmp(value, "") == 0 || strcmp(value, "ack") == 0 || strcmp(value, "unknown_action") == 0) return; + if(strcmp(value, "") == 0 || strcmp(value, "--") == 0 || strcmp(value, "ack") == 0 || strcmp(value, "unknown_action") == 0) return; Serial.print(F("Opener lock action received: ")); Serial.println(value); diff --git a/Version.h b/Version.h index 62355c0..62a7fc7 100644 --- a/Version.h +++ b/Version.h @@ -1,3 +1,3 @@ #pragma once -#define nuki_hub_version "6.2" \ No newline at end of file +#define nuki_hub_version "6.3" \ No newline at end of file diff --git a/webflash/nuki_hub.bin b/webflash/nuki_hub.bin index 881239a..4b7d643 100644 Binary files a/webflash/nuki_hub.bin and b/webflash/nuki_hub.bin differ