show pairing and mqtt status in configuration page
This commit is contained in:
@@ -68,6 +68,7 @@ bool Network::reconnect()
|
||||
// Attempt to connect
|
||||
if (_mqttClient.connect("nukiHub")) {
|
||||
Serial.println(F("MQTT connected"));
|
||||
_mqttConnected = true;
|
||||
|
||||
// ... and resubscribe
|
||||
_mqttClient.subscribe(mqtt_topic_lockstate_action);
|
||||
@@ -76,12 +77,13 @@ bool Network::reconnect()
|
||||
{
|
||||
Serial.print(F("MQTT connect failed, rc="));
|
||||
Serial.println(_mqttClient.state());
|
||||
_mqttConnected = false;
|
||||
_nextReconnect = millis() + 5000;
|
||||
}
|
||||
}
|
||||
return _mqttConnected;
|
||||
}
|
||||
|
||||
|
||||
void Network::update()
|
||||
{
|
||||
if(!WiFi.isConnected())
|
||||
@@ -167,3 +169,8 @@ void Network::publishInt(const char *topic, const int value)
|
||||
itoa(value, str, 10);
|
||||
_mqttClient.publish(topic, str);
|
||||
}
|
||||
|
||||
bool Network::isMqttConnected()
|
||||
{
|
||||
return _mqttConnected;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user