only print DHT info when capability is set
This commit is contained in:
parent
89ac7b2dc9
commit
9a57ab474b
30
things.ino
30
things.ino
@ -363,15 +363,17 @@ void setup() {
|
|||||||
response += "</h1>\r\n";
|
response += "</h1>\r\n";
|
||||||
response += "<h3>Sensor Status</h3>\r\n";
|
response += "<h3>Sensor Status</h3>\r\n";
|
||||||
response += "<table>\r\n";
|
response += "<table>\r\n";
|
||||||
response += "<tr><td>Temperature</td><td>";
|
if (capability_dht) {
|
||||||
response += str_temperature;
|
response += "<tr><td>Temperature</td><td>";
|
||||||
response += "°C</td></tr>\r\n";
|
response += str_temperature;
|
||||||
response += "<tr><td>Humidity</td><td>";
|
response += "°C</td></tr>\r\n";
|
||||||
response += str_humidity;
|
response += "<tr><td>Humidity</td><td>";
|
||||||
response += "%RH</td></tr>\r\n";
|
response += str_humidity;
|
||||||
response += "<tr><td>Heat Index</td><td>";
|
response += "%RH</td></tr>\r\n";
|
||||||
response += str_heatindex;
|
response += "<tr><td>Heat Index</td><td>";
|
||||||
response += "°C</td></tr>\r\n";
|
response += str_heatindex;
|
||||||
|
response += "°C</td></tr>\r\n";
|
||||||
|
}
|
||||||
response += "</table>\r\n";
|
response += "</table>\r\n";
|
||||||
response += "<form action=\"/\" method=\"get\"><button>Reload</button></form>\r\n";
|
response += "<form action=\"/\" method=\"get\"><button>Reload</button></form>\r\n";
|
||||||
response += "</div>\r\n";
|
response += "</div>\r\n";
|
||||||
@ -407,10 +409,12 @@ void setup() {
|
|||||||
mqtt["server"] = mqtt_server;
|
mqtt["server"] = mqtt_server;
|
||||||
mqtt["port"] = mqtt_port;
|
mqtt["port"] = mqtt_port;
|
||||||
mqtt["topic"] = mqtt_topic;
|
mqtt["topic"] = mqtt_topic;
|
||||||
JsonObject& dht = json.createNestedObject("dht");
|
if (capability_dht) {
|
||||||
dht["temperature"] = str_temperature;
|
JsonObject& dht = json.createNestedObject("dht");
|
||||||
dht["humidity"] = str_humidity;
|
dht["temperature"] = str_temperature;
|
||||||
dht["heatindex"] = str_heatindex;
|
dht["humidity"] = str_humidity;
|
||||||
|
dht["heatindex"] = str_heatindex;
|
||||||
|
}
|
||||||
String response;
|
String response;
|
||||||
json.printTo(response);
|
json.printTo(response);
|
||||||
http_server.send(200, "text/plain", response);
|
http_server.send(200, "text/plain", response);
|
||||||
|
Loading…
Reference in New Issue
Block a user