diff --git a/software/src/janitza.cpp b/software/src/janitza.cpp index af3a7a2..5855b1b 100644 --- a/software/src/janitza.cpp +++ b/software/src/janitza.cpp @@ -161,10 +161,10 @@ JsonDocument Janitza::generateJson() { if (regDef->phaseTag != P_NONE) { const char *phaseStr = phaseTagStr[regDef->phaseTag]; - doc["values"][regDef->nameStr][phaseStr] = val; + doc["Values"][regDef->nameStr][phaseStr] = val; } else { - doc["values"][regDef->nameStr] = val; + doc["Values"][regDef->nameStr] = val; } } diff --git a/software/src/main.cpp b/software/src/main.cpp index f98b00b..37f9eb9 100644 --- a/software/src/main.cpp +++ b/software/src/main.cpp @@ -67,6 +67,11 @@ void setup() { DBG.begin(115200); DBG.println("\nJanitza UMG96RM Power Analyzer to Influx\n"); MODUBS_SERIAL.begin(MODBUS_BAUD); + + initEthernet(); + connectEthernet(); + mqttInit(); + janitza.setDebugSerial(DBG); janitza.useRS485(MODBUS_DE_PIN, MODBUS_RE_PIN, preTransmission, postTransmission); #if USE_INFLUXDB @@ -77,9 +82,6 @@ void setup() { // janitza.read(); - initEthernet(); - connectEthernet(); - mqttInit(); } uint32_t lastUpdate = 0; @@ -99,6 +101,7 @@ void loop () { size_t len = serializeJson(doc, buf); String topic = MQTT_BASE_TOPIC; topic += String(janitza.getSerialNumber()); + topic += "/json"; mqttPublish(topic.c_str(), buf, len); } #endif