From 66182ac1be4e1831a6a3a539cf6f95fa1546b1b4 Mon Sep 17 00:00:00 2001 From: 1technophile Date: Sat, 2 Dec 2017 11:23:43 +0100 Subject: [PATCH] publish version when online and subjects constitution improvment --- OpenMQTTGateway.ino | 2 ++ User_config.h | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenMQTTGateway.ino b/OpenMQTTGateway.ino index f5b8a4e..bed9ee0 100644 --- a/OpenMQTTGateway.ino +++ b/OpenMQTTGateway.ino @@ -92,6 +92,8 @@ boolean reconnect() { trc(F("Connected to broker")); // Once connected, publish an announcement... client.publish(will_Topic,Gateway_AnnouncementMsg,will_Retain); + // publish version + client.publish(version_Topic,VERSION,will_Retain); //Subscribing to topic if (client.subscribe(subjectMQTTtoX)) { #ifdef ZgatewayRF diff --git a/User_config.h b/User_config.h index df56c98..57ba74d 100644 --- a/User_config.h +++ b/User_config.h @@ -28,15 +28,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - +/*-------------------VERSION----------------------*/ +#define VERSION "0.5" /*-------------DEFINE YOUR NETWORK PARAMETERS BELOW----------------*/ //MQTT Parameters definition #define mqtt_server "192.168.1.17" //#define mqtt_user "your_username" // not compulsory only if your broker needs authentication #define mqtt_password "your_password" // not compulsory only if your broker needs authentication #define mqtt_port 1883 -#define Gateway_Name "OpenMQTTGateway" -#define will_Topic "home/OpenMQTTGateway/LWT" +#define version_Topic "home/" Gateway_Name "/version" +#define will_Topic "home/" Gateway_Name "/LWT" #define will_QoS 0 #define will_Retain true #define will_Message "Offline"