Add auth info
This commit is contained in:
@@ -299,6 +299,8 @@ void NetworkLock::publishKeyTurnerState(const NukiLock::KeyTurnerState& keyTurne
|
|||||||
}
|
}
|
||||||
|
|
||||||
json["keypad_battery_critical"] = keypadBatteryCritical;
|
json["keypad_battery_critical"] = keypadBatteryCritical;
|
||||||
|
json["auth_id"] = authId;
|
||||||
|
json["auth_name"] = authName;
|
||||||
|
|
||||||
_firstTunerStatePublish = false;
|
_firstTunerStatePublish = false;
|
||||||
}
|
}
|
||||||
@@ -328,8 +330,6 @@ void NetworkLock::publishAuthorizationInfo(const std::list<NukiLock::LogEntry>&
|
|||||||
char str[50];
|
char str[50];
|
||||||
|
|
||||||
bool authFound = false;
|
bool authFound = false;
|
||||||
uint32_t authId = 0;
|
|
||||||
char authName[33];
|
|
||||||
memset(authName, 0, sizeof(authName));
|
memset(authName, 0, sizeof(authName));
|
||||||
|
|
||||||
DynamicJsonDocument json(_bufferSize);
|
DynamicJsonDocument json(_bufferSize);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ private:
|
|||||||
|
|
||||||
bool _firstTunerStatePublish = true;
|
bool _firstTunerStatePublish = true;
|
||||||
unsigned long _lastMaintenanceTs = 0;
|
unsigned long _lastMaintenanceTs = 0;
|
||||||
bool _haEnabled= false;
|
bool _haEnabled = false;
|
||||||
bool _reconnected = false;
|
bool _reconnected = false;
|
||||||
|
|
||||||
String _keypadCommandName = "";
|
String _keypadCommandName = "";
|
||||||
@@ -81,6 +81,8 @@ private:
|
|||||||
uint _keypadCommandId = 0;
|
uint _keypadCommandId = 0;
|
||||||
int _keypadCommandEnabled = 1;
|
int _keypadCommandEnabled = 1;
|
||||||
uint8_t _queryCommands = 0;
|
uint8_t _queryCommands = 0;
|
||||||
|
uint32_t authId = 0;
|
||||||
|
char authName[33];
|
||||||
|
|
||||||
char* _buffer;
|
char* _buffer;
|
||||||
size_t _bufferSize;
|
size_t _bufferSize;
|
||||||
|
|||||||
@@ -272,6 +272,8 @@ void NetworkOpener::publishKeyTurnerState(const NukiOpener::OpenerState& keyTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
json["battery_critical"] = critical;
|
json["battery_critical"] = critical;
|
||||||
|
json["auth_id"] = authId;
|
||||||
|
json["auth_name"] = authName;
|
||||||
|
|
||||||
serializeJson(json, _buffer, _bufferSize);
|
serializeJson(json, _buffer, _bufferSize);
|
||||||
publishString(mqtt_topic_lock_json, _buffer);
|
publishString(mqtt_topic_lock_json, _buffer);
|
||||||
@@ -314,8 +316,6 @@ void NetworkOpener::publishAuthorizationInfo(const std::list<NukiOpener::LogEntr
|
|||||||
char str[50];
|
char str[50];
|
||||||
|
|
||||||
bool authFound = false;
|
bool authFound = false;
|
||||||
uint32_t authId = 0;
|
|
||||||
char authName[33];
|
|
||||||
memset(authName, 0, sizeof(authName));
|
memset(authName, 0, sizeof(authName));
|
||||||
|
|
||||||
DynamicJsonDocument json(_bufferSize);
|
DynamicJsonDocument json(_bufferSize);
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ private:
|
|||||||
int _keypadCommandEnabled = 1;
|
int _keypadCommandEnabled = 1;
|
||||||
unsigned long _resetLockStateTs = 0;
|
unsigned long _resetLockStateTs = 0;
|
||||||
uint8_t _queryCommands = 0;
|
uint8_t _queryCommands = 0;
|
||||||
|
uint32_t authId = 0;
|
||||||
|
char authName[33];
|
||||||
|
|
||||||
NukiOpener::LockState _currentLockState = NukiOpener::LockState::Undefined;
|
NukiOpener::LockState _currentLockState = NukiOpener::LockState::Undefined;
|
||||||
|
|
||||||
char* _buffer;
|
char* _buffer;
|
||||||
|
|||||||
@@ -324,8 +324,14 @@ void NukiWrapper::updateKeyTurnerState()
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_retryLockstateCount = 0;
|
_retryLockstateCount = 0;
|
||||||
|
|
||||||
|
if(_publishAuthData)
|
||||||
|
{
|
||||||
|
updateAuthData();
|
||||||
|
}
|
||||||
|
|
||||||
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
|
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
|
||||||
updateGpioOutputs();
|
updateGpioOutputs();
|
||||||
|
|
||||||
@@ -333,11 +339,6 @@ void NukiWrapper::updateKeyTurnerState()
|
|||||||
lockstateToString(_keyTurnerState.lockState, lockStateStr);
|
lockstateToString(_keyTurnerState.lockState, lockStateStr);
|
||||||
Log->println(lockStateStr);
|
Log->println(lockStateStr);
|
||||||
|
|
||||||
if(_publishAuthData)
|
|
||||||
{
|
|
||||||
updateAuthData();
|
|
||||||
}
|
|
||||||
|
|
||||||
postponeBleWatchdog();
|
postponeBleWatchdog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user