ignore action after reconnect / restart

This commit is contained in:
technyon
2022-12-16 18:24:44 +01:00
parent 82bbd0b4cd
commit b625e284c7
4 changed files with 12 additions and 4 deletions

View File

@@ -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());

View File

@@ -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);

View File

@@ -1,3 +1,3 @@
#pragma once
#define nuki_hub_version "6.2"
#define nuki_hub_version "6.3"

Binary file not shown.