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>();
// Chirp
JsonObject objSensorsChirp = jsonDebug["sensors"]["chirp"].add<JsonObject>();
objSensorsChirp["temperature"] = getTemperature(2);
objSensorsChirp["soilmoisture"] = getSoilmoisture(2);
objSensorsChirp["light"] = getLightchirp();
objSensors["chirp"]["temperature"] = getTemperature(2);
objSensors["chirp"]["soilmoisture"] = getSoilmoisture(2);
objSensors["chirp"]["light"] = getLightchirp();
// DHT11/22
JsonObject objSensorsDht = jsonDebug["sensors"]["dht"].add<JsonObject>();
objSensorsDht["temperature"] = getTemperature(1);
objSensorsDht["humidity"] = getHumidity();
objSensors["dht"]["temperature"] = getTemperature(1);
objSensors["dht"]["humidity"] = getHumidity();
// Analog
JsonObject objSensorsAnalog = jsonDebug["sensors"]["analog"].add<JsonObject>();
objSensorsAnalog["soilmoisture"] = getSoilmoisture(1);
objSensorsAnalog["waterlevel"] = getWaterlevel();
objSensors["analog"]["soilmoisture"] = getSoilmoisture(1);
objSensors["analog"]["waterlevel"] = getWaterlevel();
String body;
serializeJsonPretty(jsonDebug, body);
webserver.send(200, "text/json", body);