From 78a635f82414ba9e3d740699c466fa6eee373dee Mon Sep 17 00:00:00 2001 From: Matthias Prinke <83612361+matthias-bs@users.noreply.github.com> Date: Mon, 10 Jul 2023 22:25:46 +0200 Subject: [PATCH] Update BresserWeatherSensorMQTT.ino --- .../BresserWeatherSensorMQTT.ino | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/examples/BresserWeatherSensorMQTT/BresserWeatherSensorMQTT.ino b/examples/BresserWeatherSensorMQTT/BresserWeatherSensorMQTT.ino index 760c9522..16e4e433 100644 --- a/examples/BresserWeatherSensorMQTT/BresserWeatherSensorMQTT.ino +++ b/examples/BresserWeatherSensorMQTT/BresserWeatherSensorMQTT.ino @@ -32,7 +32,8 @@ // - none - // // MQTT publications: -// /data/ sensor data as JSON string - see publishWeatherdata() +// //data sensor data as JSON string - see publishWeatherdata() +// //rssi sensor specific RSSI // /extra calculated data // /radio radio transceiver info as JSON string - see publishRadio() // /status "online"|"offline"|"dead"$ @@ -88,6 +89,7 @@ // 20230124 Improved WiFi connection robustness // 20230708 Changed MQTT payload and topic from char[] to String // 20230710 Added optional JSON output of floating point values as strings +// Modified MQTT topics // // ToDo: // @@ -270,6 +272,7 @@ const char MQTT_PUB_STATUS[] = "/status"; const char MQTT_PUB_RADIO[] = "/radio"; const char MQTT_PUB_DATA[] = "/data"; const char MQTT_PUB_EXTRA[] = "/extra"; +const char MQTT_PUB_RSSI[] = "/rssi"; char mqttPubStatus[TOPIC_SIZE]; char mqttPubRadio[TOPIC_SIZE]; @@ -516,17 +519,23 @@ void publishWeatherdata(bool complete) } // Try to map sensor ID to name to make MQTT topic explanatory + String mqtt_topic_sensor; for (int n=0; n 2) { log_i("%s: %s\n", mqttPubExtra, mqtt_payload_tmp); - client.publish(mqttPubExtra, mqtt_payload2.substring(0, PAYLOAD_SIZE-1), false, 0); + client.publish(mqtt_topic, mqtt_payload2.substring(0, PAYLOAD_SIZE-1), false, 0); } } // for (int i=0; i