show hw and fw version in sysinfo page

This commit is contained in:
technyon
2023-02-20 20:53:05 +01:00
parent 4676f24e5f
commit 6597814e06
6 changed files with 45 additions and 3 deletions

View File

@@ -138,6 +138,7 @@ void NukiOpenerWrapper::update()
if(_restartBeaconTimeout > 0 &&
ts > 60000 &&
lastReceivedBeaconTs > 0 &&
_disableBleWatchdogTs < ts &&
(ts - lastReceivedBeaconTs > _restartBeaconTimeout * 1000))
{
Log->print("No BLE beacon received from the opener for ");
@@ -335,6 +336,8 @@ void NukiOpenerWrapper::updateConfig()
_hasKeypad = _nukiConfig.hasKeypad > 0;
if(_nukiConfigValid)
{
_firmwareVersion = std::to_string(_nukiConfig.firmwareVersion[0]) + "." + std::to_string(_nukiConfig.firmwareVersion[1]) + "." + std::to_string(_nukiConfig.firmwareVersion[2]);
_hardwareVersion = std::to_string(_nukiConfig.hardwareRevision[0]) + "." + std::to_string(_nukiConfig.hardwareRevision[1]);
_network->publishConfig(_nukiConfig);
}
if(_nukiAdvancedConfigValid)
@@ -667,3 +670,13 @@ void NukiOpenerWrapper::printCommandResult(Nuki::CmdResult result)
NukiOpener::cmdResultToString(result, resultStr);
Log->println(resultStr);
}
std::string NukiOpenerWrapper::firmwareVersion() const
{
return _firmwareVersion;
}
std::string NukiOpenerWrapper::hardwareVersion() const
{
return _hardwareVersion;
}

View File

@@ -27,6 +27,9 @@ public:
const bool hasKeypad();
const BLEAddress getBleAddress() const;
std::string firmwareVersion() const;
std::string hardwareVersion() const;
BleScanner::Scanner* bleScanner();
void notify(NukiOpener::EventType eventType) override;
@@ -101,5 +104,7 @@ private:
long _nextRssiTs = 0;
unsigned long _lastRssi = 0;
unsigned long _disableBleWatchdogTs = 0;
std::string _firmwareVersion = "";
std::string _hardwareVersion = "";
NukiOpener::LockAction _nextLockAction = (NukiOpener::LockAction)0xff;
};

View File

@@ -333,6 +333,8 @@ void NukiWrapper::updateConfig()
_hasKeypad = _nukiConfig.hasKeypad > 0;
if(_nukiConfigValid)
{
_firmwareVersion = std::to_string(_nukiConfig.firmwareVersion[0]) + "." + std::to_string(_nukiConfig.firmwareVersion[1]) + "." + std::to_string(_nukiConfig.firmwareVersion[2]);
_hardwareVersion = std::to_string(_nukiConfig.hardwareRevision[0]) + "." + std::to_string(_nukiConfig.hardwareRevision[1]);
_network->publishConfig(_nukiConfig);
}
if(_nukiAdvancedConfigValid)
@@ -696,3 +698,13 @@ void NukiWrapper::printCommandResult(Nuki::CmdResult result)
NukiLock::cmdResultToString(result, resultStr);
Log->println(resultStr);
}
std::string NukiWrapper::firmwareVersion() const
{
return _firmwareVersion;
}
std::string NukiWrapper::hardwareVersion() const
{
return _hardwareVersion;
}

View File

@@ -30,6 +30,9 @@ public:
const bool hasKeypad();
const BLEAddress getBleAddress() const;
std::string firmwareVersion() const;
std::string hardwareVersion() const;
void notify(Nuki::EventType eventType) override;
private:
@@ -102,5 +105,7 @@ private:
unsigned long _nextRssiTs = 0;
unsigned long _lastRssi = 0;
unsigned long _disableBleWatchdogTs = 0;
std::string _firmwareVersion = "";
std::string _hardwareVersion = "";
volatile NukiLock::LockAction _nextLockAction = (NukiLock::LockAction)0xff;
};

View File

@@ -742,7 +742,7 @@ void WebCfgServer::buildInfoHtml(String &response)
buildHtmlHeader(response);
response.concat("<h3>System Information</h3> <pre>");
response.concat("Firmware version: ");
response.concat("NUKI Hub version: ");
response.concat(NUKI_HUB_VERSION);
response.concat("\n");
@@ -753,14 +753,21 @@ void WebCfgServer::buildInfoHtml(String &response)
if(_nuki != nullptr)
{
response.concat("Lock paired: ");
response.concat("Lock firmware version: ");
response.concat(_nuki->firmwareVersion().c_str());
response.concat("\nLock hardware version: ");
response.concat(_nuki->hardwareVersion().c_str());
response.concat("\nLock paired: ");
response.concat(_nuki->isPaired() ? "Yes\n" : "No\n");
response.concat("Lock PIN set: ");
response.concat(_nuki->isPaired() ? _nuki->isPinSet() ? "Yes\n" : "No\n" : "-\n");
}
if(_nukiOpener != nullptr)
{
response.concat("Opener paired: ");
response.concat("Opener firmware version: ");
response.concat(_nukiOpener->firmwareVersion().c_str());
response.concat("\nOpener hardware version: ");
response.concat(_nukiOpener->hardwareVersion().c_str()); response.concat("\nOpener paired: ");
response.concat(_nukiOpener->isPaired() ? "Yes\n" : "No\n");
response.concat("Opener PIN set: ");
response.concat(_nukiOpener->isPaired() ? _nukiOpener->isPinSet() ? "Yes\n" : "No\n" : "-\n");

Binary file not shown.