correct PilighttoMQTT json format

#387
This commit is contained in:
Florian committed 2019-04-30 20:50:16 +02:00
1 parent e364b37173
commit 159376b819
1 file changed
+4 -3
+4 -3
View File
@@ -46,14 +46,15 @@ void PilighttoMQTT(){
rf.loop(); rf.loop();
} }
void pilightCallback(const String &protocol, const String &message, int status, void pilightCallback(const String &protocol,const String &message, int status,
size_t repeats, const String &deviceID) { size_t repeats, const String &deviceID) {
if (status == VALID) { if (status == VALID) {
trc(F("Creating RF PiLight buffer")); trc(F("Creating RF PiLight buffer"));
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer; StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
JsonObject& RFPiLightdata = jsonBuffer.createObject(); JsonObject& RFPiLightdata = jsonBuffer.createObject();
trc(F("Rcv. Pilight")); StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer2;
RFPiLightdata.set("message", (char *)message.c_str()); JsonObject& msg = jsonBuffer2.parseObject(message);
RFPiLightdata.set("message", msg);
RFPiLightdata.set("protocol",(char *)protocol.c_str()); RFPiLightdata.set("protocol",(char *)protocol.c_str());
RFPiLightdata.set("length", (char *)deviceID.c_str()); RFPiLightdata.set("length", (char *)deviceID.c_str());
RFPiLightdata.set("repeats", (int)repeats); RFPiLightdata.set("repeats", (int)repeats);