diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp
index 836c4ec..7919bfe 100644
--- a/WebCfgServer.cpp
+++ b/WebCfgServer.cpp
@@ -32,6 +32,19 @@ WebCfgServer::WebCfgServer(NukiWrapper* nuki, NukiOpenerWrapper* nukiOpener, Net
const char *pass = str.c_str();
memcpy(&_credPassword, pass, str.length());
}
+
+ _pinsConfigured = true;
+
+ if(_nuki != nullptr)
+ {
+ _pinsConfigured = _pinsConfigured && _nuki->isPinSet();
+ }
+ if(_nukiOpener != nullptr)
+ {
+ _pinsConfigured = _pinsConfigured && _nukiOpener->isPinSet();
+ }
+
+ _brokerConfigured = _preferences->getString(preference_mqtt_broker).length() > 0 && _preferences->getInt(preference_mqtt_broker_port) > 0;
}
void WebCfgServer::initialize()
@@ -544,13 +557,13 @@ void WebCfgServer::buildHtml(String& response)
response.concat("
");
response.concat("
MQTT and Network Configuration
");
- buildNavigationButton(response, "Edit", "/mqttconfig");
+ buildNavigationButton(response, "Edit", "/mqttconfig", _brokerConfigured ? "" : "(!) Please configure MQTT broker");
response.concat("
NUKI Configuration
");
buildNavigationButton(response, "Edit", "/nukicfg");
response.concat("
Credentials
");
- buildNavigationButton(response, "Edit", "/cred");
+ buildNavigationButton(response, "Edit", "/cred", _pinsConfigured ? "" : "(!) Please configure PIN");
response.concat("
Firmware update
");
buildNavigationButton(response, "Open", "/ota");
@@ -681,7 +694,7 @@ void WebCfgServer::buildMqttConfigHtml(String &response)
printInputField(response, "RSTTMR", "Restart timer (minutes; -1 to disable)", _preferences->getInt(preference_restart_timer), 10);
printCheckBox(response, "MQTTLOG", "Enable MQTT logging", _preferences->getBool(preference_mqtt_log_enabled));
response.concat("");
- response.concat("* If no encryption is configured for the MQTT broker, leave empty. Only supported for WiFi connections.
");
+ response.concat("* If no encryption is configured for the MQTT broker, leave empty. Only supported for WiFi connections.
");
response.concat("IP Address assignment
");
response.concat("");
@@ -1017,14 +1030,15 @@ void WebCfgServer::printDropDown(String &response, const char *token, const char
response.concat("");
}
-void WebCfgServer::buildNavigationButton(String &response, const char *caption, const char *targetPath)
+void WebCfgServer::buildNavigationButton(String &response, const char *caption, const char *targetPath, const char* labelText)
{
response.concat("");
}
diff --git a/WebCfgServer.h b/WebCfgServer.h
index ec05e06..be8deab 100644
--- a/WebCfgServer.h
+++ b/WebCfgServer.h
@@ -52,7 +52,7 @@ private:
void printCheckBox(String& response, const char* token, const char* description, const bool value);
void printTextarea(String& response, const char *token, const char *description, const char *value, const size_t& maxLength, const bool& enabled = true, const bool& showLengthRestriction = false);
void printDropDown(String &response, const char *token, const char *description, const String preselectedValue, std::vector> options);
- void buildNavigationButton(String& response, const char* caption, const char* targetPath);
+ void buildNavigationButton(String& response, const char* caption, const char* targetPath, const char* labelText = "");
const std::vector> getNetworkDetectionOptions() const;
const std::vector> getNetworkGpioOptions() const;
@@ -74,6 +74,8 @@ private:
char _credUser[31] = {0};
char _credPassword[31] = {0};
bool _allowRestartToPortal = false;
+ bool _pinsConfigured = false;
+ bool _brokerConfigured = false;
uint32_t _transferredSize = 0;
unsigned long _otaStartTs = 0;
String _hostname;