From 77c6c06a6a45ea37f9feda22451887679bbc8679 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Wed, 12 Oct 2022 10:54:29 +0200 Subject: [PATCH] move id outside sensor block --- gateway/src/gateway.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gateway/src/gateway.cpp b/gateway/src/gateway.cpp index 2870728..17a4ed2 100644 --- a/gateway/src/gateway.cpp +++ b/gateway/src/gateway.cpp @@ -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;