ignore action after reconnect / restart
This commit is contained in:
@@ -45,6 +45,7 @@ void NetworkLock::initialize()
|
|||||||
|
|
||||||
_haEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";
|
_haEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";
|
||||||
|
|
||||||
|
_network->initTopic(_mqttPath, mqtt_topic_lock_action, "--");
|
||||||
_network->subscribe(_mqttPath, mqtt_topic_lock_action);
|
_network->subscribe(_mqttPath, mqtt_topic_lock_action);
|
||||||
for(const auto& topic : _configTopics)
|
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(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.print(F("Lock action received: "));
|
||||||
Serial.println(value);
|
Serial.println(value);
|
||||||
@@ -104,13 +105,19 @@ void NetworkLock::onMqttDataReceived(char *&topic, byte *&payload, unsigned int
|
|||||||
{
|
{
|
||||||
if(_keypadCommandReceivedReceivedCallback != nullptr)
|
if(_keypadCommandReceivedReceivedCallback != nullptr)
|
||||||
{
|
{
|
||||||
|
if(strcmp(value, "--") != 0) return;
|
||||||
|
|
||||||
_keypadCommandReceivedReceivedCallback(value, _keypadCommandId, _keypadCommandName, _keypadCommandCode, _keypadCommandEnabled);
|
_keypadCommandReceivedReceivedCallback(value, _keypadCommandId, _keypadCommandName, _keypadCommandCode, _keypadCommandEnabled);
|
||||||
|
|
||||||
_keypadCommandId = 0;
|
_keypadCommandId = 0;
|
||||||
_keypadCommandName = "--";
|
_keypadCommandName = "--";
|
||||||
_keypadCommandCode = "000000";
|
_keypadCommandCode = "000000";
|
||||||
_keypadCommandEnabled = 1;
|
_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);
|
publishInt(mqtt_topic_keypad_command_id, _keypadCommandId);
|
||||||
publishString(mqtt_topic_keypad_command_name, _keypadCommandName.c_str());
|
publishString(mqtt_topic_keypad_command_name, _keypadCommandName.c_str());
|
||||||
publishString(mqtt_topic_keypad_command_code, _keypadCommandCode.c_str());
|
publishString(mqtt_topic_keypad_command_code, _keypadCommandCode.c_str());
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ void NetworkOpener::initialize()
|
|||||||
|
|
||||||
_haEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";
|
_haEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";
|
||||||
|
|
||||||
|
_network->initTopic(_mqttPath, mqtt_topic_lock_action, "--");
|
||||||
_network->subscribe(_mqttPath, mqtt_topic_lock_action);
|
_network->subscribe(_mqttPath, mqtt_topic_lock_action);
|
||||||
for(const auto& topic : _configTopics)
|
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(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.print(F("Opener lock action received: "));
|
||||||
Serial.println(value);
|
Serial.println(value);
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define nuki_hub_version "6.2"
|
#define nuki_hub_version "6.3"
|
||||||
Binary file not shown.
Reference in New Issue
Block a user