move id outside sensor block
This commit is contained in:
parent
3b07c1c30c
commit
77c6c06a6a
@ -61,28 +61,28 @@ void readRcSwitch(JsonDocument& jsonDoc) {
|
||||
}
|
||||
if (GET_TYPE(value) == SensorType::GENERIC) {
|
||||
JsonObject sensor = jsonDoc.createNestedObject("sensor");
|
||||
sensor["id"] = ID(value);
|
||||
jsonDoc["id"] = ID(value);
|
||||
sensor["value"] = GET_VALUE(value);
|
||||
sensor["voltage"] = GET_VCC(value);
|
||||
return;
|
||||
}
|
||||
if (GET_TYPE(value) == SensorType::TEMPERATURE) {
|
||||
JsonObject sensor = jsonDoc.createNestedObject("sensor");
|
||||
sensor["id"] = ID(value);
|
||||
jsonDoc["id"] = ID(value);
|
||||
sensor["temperature"] = GET_TEMP(value);
|
||||
sensor["voltage"] = GET_VCC(value);
|
||||
return;
|
||||
}
|
||||
if (GET_TYPE(value) == SensorType::HUMIDITY) {
|
||||
JsonObject sensor = jsonDoc.createNestedObject("sensor");
|
||||
sensor["id"] = ID(value);
|
||||
jsonDoc["id"] = ID(value);
|
||||
sensor["humidity"] = GET_HUMIDITY(value);
|
||||
sensor["voltage"] = GET_VCC(value);
|
||||
return;
|
||||
}
|
||||
if (GET_TYPE(value) == SensorType::CONTACT) {
|
||||
JsonObject sensor = jsonDoc.createNestedObject("contact");
|
||||
sensor["id"] = ID(value);
|
||||
jsonDoc["id"] = ID(value);
|
||||
sensor["state"] = GET_STATE(value) ? "on" : "off";
|
||||
sensor["voltage"] = GET_VCC(value);
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user