Merge branch 'master' into separate-config
This commit is contained in:
@@ -12,8 +12,9 @@ NetworkOpener::NetworkOpener(Network* network, Preferences* preferences, char* b
|
||||
_buffer(buffer),
|
||||
_bufferSize(bufferSize)
|
||||
{
|
||||
memset(_authName, 0, sizeof(_authName));
|
||||
_authName[0] = '\0';
|
||||
|
||||
memset(authName, 0, sizeof(authName));
|
||||
_network->registerMqttReceiver(this);
|
||||
}
|
||||
|
||||
@@ -292,8 +293,8 @@ void NetworkOpener::publishKeyTurnerState(const NukiOpener::OpenerState& keyTurn
|
||||
publishBool(mqtt_topic_battery_critical, critical);
|
||||
}
|
||||
|
||||
json["auth_id"] = authId;
|
||||
json["auth_name"] = authName;
|
||||
json["auth_id"] = _authId;
|
||||
json["auth_name"] = _authName;
|
||||
|
||||
serializeJson(json, _buffer, _bufferSize);
|
||||
publishString(mqtt_topic_lock_json, _buffer);
|
||||
@@ -354,8 +355,10 @@ void NetworkOpener::publishAuthorizationInfo(const std::list<NukiOpener::LogEntr
|
||||
{
|
||||
char str[50];
|
||||
|
||||
bool authFound = false;
|
||||
memset(authName, 0, sizeof(authName));
|
||||
_authId = 0;
|
||||
memset(_authName, 0, sizeof(_authName));
|
||||
_authName[0] = '\0';
|
||||
_authFound = false;
|
||||
|
||||
JsonDocument json;
|
||||
|
||||
@@ -368,18 +371,20 @@ void NetworkOpener::publishAuthorizationInfo(const std::list<NukiOpener::LogEntr
|
||||
}
|
||||
--i;
|
||||
|
||||
if((log.loggingType == NukiOpener::LoggingType::LockAction || log.loggingType == NukiOpener::LoggingType::KeypadAction) && ! authFound)
|
||||
if((log.loggingType == NukiOpener::LoggingType::LockAction || log.loggingType == NukiOpener::LoggingType::KeypadAction) && ! _authFound)
|
||||
{
|
||||
authFound = true;
|
||||
authId = log.authId;
|
||||
memcpy(authName, log.name, sizeof(log.name));
|
||||
_authFound = true;
|
||||
_authId = log.authId;
|
||||
int sizeName = sizeof(log.name);
|
||||
memcpy(_authName, log.name, sizeName);
|
||||
if(_authName[sizeName - 1] != '\0') _authName[sizeName] = '\0';
|
||||
}
|
||||
|
||||
auto entry = json.add();
|
||||
|
||||
entry["index"] = log.index;
|
||||
entry["authorizationId"] = log.authId;
|
||||
entry["authorizationName"] = log.name;
|
||||
entry["authorizationName"] = _authName;
|
||||
entry["timeYear"] = log.timeStampYear;
|
||||
entry["timeMonth"] = log.timeStampMonth;
|
||||
entry["timeDay"] = log.timeStampDay;
|
||||
@@ -470,10 +475,10 @@ void NetworkOpener::publishAuthorizationInfo(const std::list<NukiOpener::LogEntr
|
||||
serializeJson(json, _buffer, _bufferSize);
|
||||
publishString(mqtt_topic_lock_log, _buffer);
|
||||
|
||||
if(authFound)
|
||||
if(_authFound)
|
||||
{
|
||||
publishUInt(mqtt_topic_lock_auth_id, authId);
|
||||
publishString(mqtt_topic_lock_auth_name, authName);
|
||||
publishUInt(mqtt_topic_lock_auth_id, _authId);
|
||||
publishString(mqtt_topic_lock_auth_name, _authName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user