Seperate ring from lockstate

This commit is contained in:
iranl
2024-03-05 21:00:29 +01:00
parent a35a0b89ba
commit 4ba0501244
4 changed files with 11 additions and 11 deletions

View File

@@ -49,6 +49,7 @@ void NetworkOpener::initialize()
_network->initTopic(_mqttPath, mqtt_topic_query_config, "0");
_network->initTopic(_mqttPath, mqtt_topic_query_lockstate, "0");
_network->initTopic(_mqttPath, mqtt_topic_query_battery, "0");
_network->initTopic(_mqttPath, mqtt_topic_lock_binary_ring, "standby");
_network->subscribe(_mqttPath, mqtt_topic_query_config);
_network->subscribe(_mqttPath, mqtt_topic_query_lockstate);
_network->subscribe(_mqttPath, mqtt_topic_query_battery);
@@ -77,13 +78,10 @@ void NetworkOpener::initialize()
void NetworkOpener::update()
{
if(_resetLockStateTs != 0 && millis() >= _resetLockStateTs)
if(_resetRingStateTs != 0 && millis() >= _resetRingStateTs)
{
char str[50];
memset(str, 0, sizeof(str));
_resetLockStateTs = 0;
lockstateToString(_currentLockState, str);
publishString(mqtt_topic_lock_state, str);
_resetRingStateTs = 0;
publishString(mqtt_topic_lock_binary_ring, "standby");
}
}
@@ -278,14 +276,15 @@ void NetworkOpener::publishRing(const bool locked)
{
if (locked)
{
publishString(mqtt_topic_lock_state, "ring");
publishString(mqtt_topic_lock_ring, "ringlocked");
_resetLockStateTs = millis() + 2000;
}
else
{
publishString(mqtt_topic_lock_ring, "ring");
}
publishString(mqtt_topic_lock_binary_ring, "ring");
_resetRingStateTs = millis() + 2000;
}
void NetworkOpener::publishState(NukiOpener::OpenerState lockState)