3 Commits

3 changed files with 9 additions and 5 deletions

View File

@@ -197,14 +197,13 @@ protected:
this->haHelper->setDevicePrefix(settings.mqtt.prefix); this->haHelper->setDevicePrefix(settings.mqtt.prefix);
this->haHelper->updateCachedTopics(); this->haHelper->updateCachedTopics();
this->client->stop(); this->client->stop();
this->client->setId(networkSettings.hostname); this->client->setId(networkSettings.hostname);
this->client->setUsernamePassword(settings.mqtt.user, settings.mqtt.password); this->client->setUsernamePassword(settings.mqtt.user, settings.mqtt.password);
this->client->beginWill(this->haHelper->getDeviceTopic(F("status")).c_str(), 7, true, 1); this->client->beginWill(this->haHelper->getDeviceTopic(F("status")).c_str(), 7, true, 1);
this->client->print(F("offline")); this->client->print(F("offline"));
this->client->endWill(); this->client->endWill();
this->client->connect(settings.mqtt.server, settings.mqtt.port); this->client->connect(settings.mqtt.server, settings.mqtt.port);
this->lastReconnectTime = millis(); this->lastReconnectTime = millis();
this->yield(); this->yield();

View File

@@ -602,6 +602,11 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
} }
} }
if (dst.portal.auth && (!strlen(dst.portal.login) || !strlen(dst.portal.password))) {
dst.portal.auth = false;
changed = true;
}
// opentherm // opentherm
if (!src[FPSTR(S_OPENTHERM)][FPSTR(S_UNIT_SYSTEM)].isNull()) { if (!src[FPSTR(S_OPENTHERM)][FPSTR(S_UNIT_SYSTEM)].isNull()) {

View File

@@ -43,12 +43,12 @@
<div class="grid"> <div class="grid">
<label> <label>
<span data-i18n>settings.portal.login</span> <span data-i18n>settings.portal.login</span>
<input type="text" name="portal[login]" maxlength="12" required> <input type="text" name="portal[login]" maxlength="12">
</label> </label>
<label> <label>
<span data-i18n>settings.portal.password</span> <span data-i18n>settings.portal.password</span>
<input type="password" name="portal[password]" maxlength="32" required> <input type="password" name="portal[password]" maxlength="32">
</label> </label>
</div> </div>
@@ -511,7 +511,7 @@
<div class="grid"> <div class="grid">
<label> <label>
<span data-i18n>settings.mqtt.user</span> <span data-i18n>settings.mqtt.user</span>
<input type="text" name="mqtt[user]" maxlength="32" required> <input type="text" name="mqtt[user]" maxlength="32">
</label> </label>
<label> <label>