diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 377b6078..bb7fcc54 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -42,9 +42,9 @@ MQTT::MQTT() : pubSub(mqttClient) pubSub.setCallback(mqttCallback); DEBUG_MSG("Connecting to MQTT server: %s\n", serverAddr); - auto myStatus = (statusTopic + nodeId); + auto myStatus = (statusTopic + owner.id); // bool connected = pubSub.connect(nodeId.c_str(), "meshdev", "apes4cats", myStatus.c_str(), 1, true, "offline"); - bool connected = pubSub.connect(nodeId.c_str(), myStatus.c_str(), 1, true, "offline"); + bool connected = pubSub.connect(owner.id, myStatus.c_str(), 1, true, "offline"); if (connected) { DEBUG_MSG("MQTT connected\n"); @@ -59,7 +59,7 @@ MQTT::MQTT() : pubSub(mqttClient) } } -void MQTT::publish(const MeshPacket *mp, String channelId) +void MQTT::publish(const MeshPacket *mp) { // DEBUG_MSG("publish %s = %s\n", suffix.c_str(), payload.c_str()); @@ -71,6 +71,6 @@ const char *MQTT::getTopic(String suffix, const char *direction) static char buf[128]; // "mesh/crypt/CHANNELID/NODEID/PORTID" - snprintf(buf, sizeof(buf), "mesh/%s/%s/%s", direction, nodeId.c_str(), suffix.c_str()); + snprintf(buf, sizeof(buf), "mesh/%s/%s/%s", direction, owner.id, suffix.c_str()); return buf; } \ No newline at end of file diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 97412d2b..c4d9a8b0 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -11,9 +11,6 @@ */ class MQTT { - /// Our globally unique node ID - String nodeId = "fixmemode"; - // supposedly the current version is busted: // http://www.iotsharing.com/2017/08/how-to-use-esp32-mqtts-with-mqtts-mosquitto-broker-tls-ssl.html // WiFiClientSecure wifiClient; @@ -25,9 +22,8 @@ class MQTT /** * Publish a packet on the glboal MQTT server. - * @param channelId must be a globally unique channel ID */ - void publish(const MeshPacket *mp, String channelId); + void publish(const MeshPacket *mp); private: const char *getTopic(String suffix, const char *direction = "dev");