firmware wip - add simple json /api/debug which returns all values from eeprom and sensors

This commit is contained in:
Marcus 2024-05-10 23:27:19 +02:00
parent df1a6307f7
commit d90dfe346d

View file

@ -1017,21 +1017,20 @@ void APIgetDebug() {
JsonObject objSensors = jsonDebug["sensors"].add<JsonObject>(); JsonObject objSensors = jsonDebug["sensors"].add<JsonObject>();
// Chirp // Chirp
JsonObject objSensorsChirp = jsonDebug["sensors"]["chirp"].add<JsonObject>(); objSensors["chirp"]["temperature"] = getTemperature(2);
objSensorsChirp["temperature"] = getTemperature(2); objSensors["chirp"]["soilmoisture"] = getSoilmoisture(2);
objSensorsChirp["soilmoisture"] = getSoilmoisture(2); objSensors["chirp"]["light"] = getLightchirp();
objSensorsChirp["light"] = getLightchirp();
// DHT11/22 // DHT11/22
JsonObject objSensorsDht = jsonDebug["sensors"]["dht"].add<JsonObject>(); objSensors["dht"]["temperature"] = getTemperature(1);
objSensorsDht["temperature"] = getTemperature(1); objSensors["dht"]["humidity"] = getHumidity();
objSensorsDht["humidity"] = getHumidity();
// Analog // Analog
JsonObject objSensorsAnalog = jsonDebug["sensors"]["analog"].add<JsonObject>(); objSensors["analog"]["soilmoisture"] = getSoilmoisture(1);
objSensorsAnalog["soilmoisture"] = getSoilmoisture(1); objSensors["analog"]["waterlevel"] = getWaterlevel();
objSensorsAnalog["waterlevel"] = getWaterlevel();
String body; String body;
serializeJsonPretty(jsonDebug, body); serializeJsonPretty(jsonDebug, body);
webserver.send(200, "text/json", body); webserver.send(200, "text/json", body);