mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-11 18:54:28 +05:00
feat: added will msg for mqtt broker
This commit is contained in:
@@ -196,6 +196,11 @@ protected:
|
|||||||
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->print(F("offline"));
|
||||||
|
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();
|
||||||
|
|||||||
Reference in New Issue
Block a user