diff --git a/MqttClient.cpp b/MqttClient.cpp index 9a00577..9977058 100644 --- a/MqttClient.cpp +++ b/MqttClient.cpp @@ -174,7 +174,7 @@ void MqttClient::sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLe buf << "{ \"metadata\": { \"device\": \"MeterbusHub\", " << - "\"token\": " << token << ", " << + "\"token\": " << token << "}, " << "\"data\": {" << "\"uptime\": " << m_uptime << ", " << @@ -198,7 +198,7 @@ void MqttClient::sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLe if (m_disconnectState == 0) { //Serial << "publishing " << strbuf << endl; //Serial << "length: " << buf.length() << endl; - m_mqttClient.publish("IoT/MeterbusHub/Measurement", strbuf); + m_mqttClient.publish("IoT/Measurement/MeterbusHub", strbuf); } else { Serial << "no MQTT connection, message lost: " << endl << strbuf << endl; @@ -211,7 +211,7 @@ void MqttClient::sendError(uint8_t code, uint8_t token) { if (m_disconnectState == 0) { //Serial << "publishing " << msg << endl; //Serial << "length: " << msg.length() << endl; - m_mqttClient.publish("IoT/MeterbusHub/Measurement", (char*)msg.c_str()); + m_mqttClient.publish("IoT/Failure/MeterbusHub", (char*)msg.c_str()); } else { Serial << "no MQTT connection, message lost: " << msg << endl; } @@ -288,7 +288,7 @@ void MqttClient::exec() { byte wdogCnt = WDOG_RSTCNT; String msg = String("{ \"metadata\": { \"device\": \"MeterbusHub\" }, \"data\": { \"uptime\": ") + m_uptime + String(", \"watchdogCnt\": ") + wdogCnt + String("}}"); if (m_disconnectState == 0) { - m_mqttClient.publish("IoT/MeterbusHub/Heartbeat", (char*)msg.c_str()); + m_mqttClient.publish("IoT/Heartbeat/MeterbusHub", (char*)msg.c_str()); } else { Serial << "no MQTT connection, message lost: " << msg << endl; }