adjust topic
This commit is contained in:
parent
3cb834208d
commit
5ee153bd6a
@ -174,7 +174,7 @@ void MqttClient::sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLe
|
|||||||
|
|
||||||
|
|
||||||
buf << "{ \"metadata\": { \"device\": \"MeterbusHub\", " <<
|
buf << "{ \"metadata\": { \"device\": \"MeterbusHub\", " <<
|
||||||
"\"token\": " << token << ", " <<
|
"\"token\": " << token <<
|
||||||
"}, " <<
|
"}, " <<
|
||||||
"\"data\": {" <<
|
"\"data\": {" <<
|
||||||
"\"uptime\": " << m_uptime << ", " <<
|
"\"uptime\": " << m_uptime << ", " <<
|
||||||
@ -198,7 +198,7 @@ void MqttClient::sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLe
|
|||||||
if (m_disconnectState == 0) {
|
if (m_disconnectState == 0) {
|
||||||
//Serial << "publishing " << strbuf << endl;
|
//Serial << "publishing " << strbuf << endl;
|
||||||
//Serial << "length: " << buf.length() << endl;
|
//Serial << "length: " << buf.length() << endl;
|
||||||
m_mqttClient.publish("IoT/MeterbusHub/Measurement", strbuf);
|
m_mqttClient.publish("IoT/Measurement/MeterbusHub", strbuf);
|
||||||
} else {
|
} else {
|
||||||
Serial << "no MQTT connection, message lost: " << endl <<
|
Serial << "no MQTT connection, message lost: " << endl <<
|
||||||
strbuf << endl;
|
strbuf << endl;
|
||||||
@ -211,7 +211,7 @@ void MqttClient::sendError(uint8_t code, uint8_t token) {
|
|||||||
if (m_disconnectState == 0) {
|
if (m_disconnectState == 0) {
|
||||||
//Serial << "publishing " << msg << endl;
|
//Serial << "publishing " << msg << endl;
|
||||||
//Serial << "length: " << msg.length() << 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 {
|
} else {
|
||||||
Serial << "no MQTT connection, message lost: " << msg << endl;
|
Serial << "no MQTT connection, message lost: " << msg << endl;
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ void MqttClient::exec() {
|
|||||||
byte wdogCnt = WDOG_RSTCNT;
|
byte wdogCnt = WDOG_RSTCNT;
|
||||||
String msg = String("{ \"metadata\": { \"device\": \"MeterbusHub\" }, \"data\": { \"uptime\": ") + m_uptime + String(", \"watchdogCnt\": ") + wdogCnt + String("}}");
|
String msg = String("{ \"metadata\": { \"device\": \"MeterbusHub\" }, \"data\": { \"uptime\": ") + m_uptime + String(", \"watchdogCnt\": ") + wdogCnt + String("}}");
|
||||||
if (m_disconnectState == 0) {
|
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 {
|
} else {
|
||||||
Serial << "no MQTT connection, message lost: " << msg << endl;
|
Serial << "no MQTT connection, message lost: " << msg << endl;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user