adjust topic

This commit is contained in:
hg 2015-05-25 22:49:20 +02:00
parent 3cb834208d
commit 5ee153bd6a

View File

@ -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;
}