From e0cdf5cd8ca757cce92777c6b3babfcda6fb6388 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Tue, 30 Jul 2019 14:34:07 +0200 Subject: [PATCH] dont subscribe to own topics --- src/main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 152d30f..6b2155f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -356,10 +356,10 @@ void displayValues() { // other nodes display.setFont(NULL); display.setCursor(0, y_offset+70); - display.printf("246f28d1fa5c: %4.1f %4.1f %6.1f\n", sensors_246f28d1fa5c.temperature, sensors_246f28d1fa5c.humidity, sensors_246f28d1fa5c.pressure); - display.printf("a4cf1211c3e4: %4.1f %4.1f %6.1f\n", sensors_a4cf1211c3e4.temperature, sensors_a4cf1211c3e4.humidity, sensors_a4cf1211c3e4.pressure); - display.printf("246f28d1a080: %4.1f %4.1f %6.1f\n", sensors_246f28d1a080.temperature, sensors_246f28d1a080.humidity, sensors_246f28d1a080.pressure); - display.printf("30aea47b0568: %4.1f %4.1f %6.1f\n", sensors_30aea47b0568.temperature, sensors_30aea47b0568.humidity, sensors_30aea47b0568.pressure); + if (!ota.getMAC().equals("246f28d1fa5c")) display.printf("246f28d1fa5c: %4.1f %4.1f %6.1f\n", sensors_246f28d1fa5c.temperature, sensors_246f28d1fa5c.humidity, sensors_246f28d1fa5c.pressure); + if (!ota.getMAC().equals("a4cf1211c3e4")) display.printf("a4cf1211c3e4: %4.1f %4.1f %6.1f\n", sensors_a4cf1211c3e4.temperature, sensors_a4cf1211c3e4.humidity, sensors_a4cf1211c3e4.pressure); + if (!ota.getMAC().equals("246f28d1a080")) display.printf("246f28d1a080: %4.1f %4.1f %6.1f\n", sensors_246f28d1a080.temperature, sensors_246f28d1a080.humidity, sensors_246f28d1a080.pressure); + if (!ota.getMAC().equals("30aea47b0568")) display.printf("30aea47b0568: %4.1f %4.1f %6.1f\n", sensors_30aea47b0568.temperature, sensors_30aea47b0568.humidity, sensors_30aea47b0568.pressure); } while (display.nextPage()); @@ -561,10 +561,10 @@ void setup() ESP_LOGD(TAG, "connecting to MQTT"); mqtt.begin(); - mqtt.subscribe("thomas/sensor/a4cf1211c3e4/#", receiveMqtt); - mqtt.subscribe("thomas/sensor/246f28d1fa5c/#", receiveMqtt); - mqtt.subscribe("thomas/sensor/246f28d1a080/#", receiveMqtt); - mqtt.subscribe("thomas/sensor/30aea47b0568/#", receiveMqtt); + if (!ota.getMAC().equals("a4cf1211c3e4")) mqtt.subscribe("thomas/sensor/a4cf1211c3e4/#", receiveMqtt); + if (!ota.getMAC().equals("246f28d1fa5c")) mqtt.subscribe("thomas/sensor/246f28d1fa5c/#", receiveMqtt); + if (!ota.getMAC().equals("246f28d1a080")) mqtt.subscribe("thomas/sensor/246f28d1a080/#", receiveMqtt); + if (!ota.getMAC().equals("30aea47b0568")) mqtt.subscribe("thomas/sensor/30aea47b0568/#", receiveMqtt); ESP_LOGD(TAG, "setup done"); }