diff --git a/main.cpp b/main.cpp index 595fe25..0db355d 100644 --- a/main.cpp +++ b/main.cpp @@ -44,11 +44,12 @@ static void send_sensor(TCPSocket* socket, uint8_t id, bool state) lastState = state; - std::string json = "{ \"Type\": \"Sensor\", \"SensorType\": 254, "; + std::string json = "{ \"MessageType\": \"SensorUpdate\", \"Data\": [{ \"Type\": \"Sensor\", \"SensorType\": 254, "; json.append("\"Id\": " + std::to_string(static_cast(id)) + ", "); - json.append("\"Field\":" + std::to_string(static_cast(state))); - json.append(" }\n"); + json.append("\"Field\": " + std::to_string(static_cast(state))); + json.append(" }] }\n"); std::string sendbuf(MSG_STRING + std::to_string(json.length()) + "\n" + json); + Log(Log::DEBUG)<<"Sending: \n"<send(sendbuf.c_str(), sendbuf.size()); }