Home page show mqtt status
This commit is contained in:
parent
cbbf4b2b3d
commit
a145dc9a9c
@ -26,6 +26,10 @@ int setupMQTT(char *server, char *user, char *passwd, int port) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MQTT_isConnected(){
|
||||
return mqtt->connected();
|
||||
}
|
||||
|
||||
// Function to connect and reconnect as necessary to the MQTT server.
|
||||
// Should be called in the loop function and it will take care if connecting.
|
||||
int MQTT_connect() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
void handleRoot() {
|
||||
server.send(200, "text/html", "<h1>You are connected</h1><br/>"
|
||||
"Current temperature " + String(temp, 2) + "C<br/>"
|
||||
"MQTT Status :" + (MQTT_isConnected()? "Connected":"Disconnected") +"<br/>"
|
||||
"<a href=\"/setup\">Setup</a><br/>"
|
||||
"<a href=\"/otamode\">OTA mode</a><br/>"
|
||||
"<a href=\"/gpio?gpio=2&value=1\">ON</a><br/>"
|
||||
|
@ -70,6 +70,7 @@ int getTemperature(double &t);
|
||||
|
||||
/* MQTT decl */
|
||||
int MQTT_connect();
|
||||
int MQTT_isConnected();
|
||||
int setupMQTT(char *server, char *user, char *passwd, int port);
|
||||
int publishMQTT(int temp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user