Seperate ring from lockstate
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#define mqtt_topic_lock_binary_state "/lock/binaryState"
|
#define mqtt_topic_lock_binary_state "/lock/binaryState"
|
||||||
#define mqtt_topic_lock_continuous_mode "/lock/continuousMode"
|
#define mqtt_topic_lock_continuous_mode "/lock/continuousMode"
|
||||||
#define mqtt_topic_lock_ring "/lock/ring"
|
#define mqtt_topic_lock_ring "/lock/ring"
|
||||||
|
#define mqtt_topic_lock_binary_ring "/lock/binaryRing"
|
||||||
#define mqtt_topic_lock_trigger "/lock/trigger"
|
#define mqtt_topic_lock_trigger "/lock/trigger"
|
||||||
#define mqtt_topic_lock_last_lock_action "/lock/lastLockAction"
|
#define mqtt_topic_lock_last_lock_action "/lock/lastLockAction"
|
||||||
#define mqtt_topic_lock_log "/lock/log"
|
#define mqtt_topic_lock_log "/lock/log"
|
||||||
|
|||||||
@@ -1219,14 +1219,14 @@ void Network::publishHASSConfigRingDetect(char *deviceType, const char *baseTopi
|
|||||||
"Ring detect",
|
"Ring detect",
|
||||||
name,
|
name,
|
||||||
baseTopic,
|
baseTopic,
|
||||||
String("~") + mqtt_topic_lock_state,
|
String("~") + mqtt_topic_lock_binary_ring,
|
||||||
deviceType,
|
deviceType,
|
||||||
"sound",
|
"sound",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
{{"pl_on", "ring"},
|
{{"pl_on", "ring"},
|
||||||
{"pl_off", "locked"}});
|
{"pl_off", "standby"}});
|
||||||
|
|
||||||
DynamicJsonDocument json(_bufferSize);
|
DynamicJsonDocument json(_bufferSize);
|
||||||
json = createHassJson(uidString, "_ring_event", "Ring", name, baseTopic, String("~") + mqtt_topic_lock_ring, deviceType, "doorbell", "", "", "", {{"value_template", "{ \"event_type\": \"{{ value }}\" }"}});
|
json = createHassJson(uidString, "_ring_event", "Ring", name, baseTopic, String("~") + mqtt_topic_lock_ring, deviceType, "doorbell", "", "", "", {{"value_template", "{ \"event_type\": \"{{ value }}\" }"}});
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ void NetworkOpener::initialize()
|
|||||||
_network->initTopic(_mqttPath, mqtt_topic_query_config, "0");
|
_network->initTopic(_mqttPath, mqtt_topic_query_config, "0");
|
||||||
_network->initTopic(_mqttPath, mqtt_topic_query_lockstate, "0");
|
_network->initTopic(_mqttPath, mqtt_topic_query_lockstate, "0");
|
||||||
_network->initTopic(_mqttPath, mqtt_topic_query_battery, "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_config);
|
||||||
_network->subscribe(_mqttPath, mqtt_topic_query_lockstate);
|
_network->subscribe(_mqttPath, mqtt_topic_query_lockstate);
|
||||||
_network->subscribe(_mqttPath, mqtt_topic_query_battery);
|
_network->subscribe(_mqttPath, mqtt_topic_query_battery);
|
||||||
@@ -77,13 +78,10 @@ void NetworkOpener::initialize()
|
|||||||
|
|
||||||
void NetworkOpener::update()
|
void NetworkOpener::update()
|
||||||
{
|
{
|
||||||
if(_resetLockStateTs != 0 && millis() >= _resetLockStateTs)
|
if(_resetRingStateTs != 0 && millis() >= _resetRingStateTs)
|
||||||
{
|
{
|
||||||
char str[50];
|
_resetRingStateTs = 0;
|
||||||
memset(str, 0, sizeof(str));
|
publishString(mqtt_topic_lock_binary_ring, "standby");
|
||||||
_resetLockStateTs = 0;
|
|
||||||
lockstateToString(_currentLockState, str);
|
|
||||||
publishString(mqtt_topic_lock_state, str);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,14 +276,15 @@ void NetworkOpener::publishRing(const bool locked)
|
|||||||
{
|
{
|
||||||
if (locked)
|
if (locked)
|
||||||
{
|
{
|
||||||
publishString(mqtt_topic_lock_state, "ring");
|
|
||||||
publishString(mqtt_topic_lock_ring, "ringlocked");
|
publishString(mqtt_topic_lock_ring, "ringlocked");
|
||||||
_resetLockStateTs = millis() + 2000;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
publishString(mqtt_topic_lock_ring, "ring");
|
publishString(mqtt_topic_lock_ring, "ring");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishString(mqtt_topic_lock_binary_ring, "ring");
|
||||||
|
_resetRingStateTs = millis() + 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkOpener::publishState(NukiOpener::OpenerState lockState)
|
void NetworkOpener::publishState(NukiOpener::OpenerState lockState)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ private:
|
|||||||
String _keypadCommandCode = "";
|
String _keypadCommandCode = "";
|
||||||
uint _keypadCommandId = 0;
|
uint _keypadCommandId = 0;
|
||||||
int _keypadCommandEnabled = 1;
|
int _keypadCommandEnabled = 1;
|
||||||
unsigned long _resetLockStateTs = 0;
|
unsigned long _resetRingStateTs = 0;
|
||||||
uint8_t _queryCommands = 0;
|
uint8_t _queryCommands = 0;
|
||||||
uint32_t authId = 0;
|
uint32_t authId = 0;
|
||||||
char authName[33];
|
char authName[33];
|
||||||
|
|||||||
Reference in New Issue
Block a user