Add auth info

This commit is contained in:
iranl
2024-02-17 11:42:03 +01:00
parent c2615e537a
commit 7937ec8c65
5 changed files with 17 additions and 11 deletions

View File

@@ -299,6 +299,8 @@ void NetworkLock::publishKeyTurnerState(const NukiLock::KeyTurnerState& keyTurne
}
json["keypad_battery_critical"] = keypadBatteryCritical;
json["auth_id"] = authId;
json["auth_name"] = authName;
_firstTunerStatePublish = false;
}
@@ -328,8 +330,6 @@ void NetworkLock::publishAuthorizationInfo(const std::list<NukiLock::LogEntry>&
char str[50];
bool authFound = false;
uint32_t authId = 0;
char authName[33];
memset(authName, 0, sizeof(authName));
DynamicJsonDocument json(_bufferSize);

View File

@@ -73,14 +73,16 @@ private:
bool _firstTunerStatePublish = true;
unsigned long _lastMaintenanceTs = 0;
bool _haEnabled= false;
bool _haEnabled = false;
bool _reconnected = false;
String _keypadCommandName = "";
String _keypadCommandCode = "";
uint _keypadCommandId = 0;
int _keypadCommandEnabled = 1;
uint8_t _queryCommands = 0;
uint8_t _queryCommands = 0;
uint32_t authId = 0;
char authName[33];
char* _buffer;
size_t _bufferSize;

View File

@@ -272,6 +272,8 @@ void NetworkOpener::publishKeyTurnerState(const NukiOpener::OpenerState& keyTurn
}
json["battery_critical"] = critical;
json["auth_id"] = authId;
json["auth_name"] = authName;
serializeJson(json, _buffer, _bufferSize);
publishString(mqtt_topic_lock_json, _buffer);
@@ -314,8 +316,6 @@ void NetworkOpener::publishAuthorizationInfo(const std::list<NukiOpener::LogEntr
char str[50];
bool authFound = false;
uint32_t authId = 0;
char authName[33];
memset(authName, 0, sizeof(authName));
DynamicJsonDocument json(_bufferSize);

View File

@@ -82,6 +82,9 @@ private:
int _keypadCommandEnabled = 1;
unsigned long _resetLockStateTs = 0;
uint8_t _queryCommands = 0;
uint32_t authId = 0;
char authName[33];
NukiOpener::LockState _currentLockState = NukiOpener::LockState::Undefined;
char* _buffer;

View File

@@ -324,8 +324,14 @@ void NukiWrapper::updateKeyTurnerState()
}
return;
}
_retryLockstateCount = 0;
if(_publishAuthData)
{
updateAuthData();
}
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
updateGpioOutputs();
@@ -333,11 +339,6 @@ void NukiWrapper::updateKeyTurnerState()
lockstateToString(_keyTurnerState.lockState, lockStateStr);
Log->println(lockStateStr);
if(_publishAuthData)
{
updateAuthData();
}
postponeBleWatchdog();
}