From 88a7076ad3b906f8aeee0ae6978332f0e61b4335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Wed, 10 Oct 2018 13:25:42 +0200 Subject: [PATCH] Report SSID with heartbeat messages --- code/espurna/config/general.h | 2 ++ code/espurna/utils.ino | 3 +++ 2 files changed, 5 insertions(+) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 04850ea1..2ab3040c 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -187,6 +187,7 @@ // Topics that will be reported in heartbeat #define HEARTBEAT_REPORT_STATUS 1 +#define HEARTBEAT_REPORT_SSID 1 #define HEARTBEAT_REPORT_IP 1 #define HEARTBEAT_REPORT_MAC 1 #define HEARTBEAT_REPORT_RSSI 1 @@ -731,6 +732,7 @@ #define MQTT_TOPIC_LED "led" #define MQTT_TOPIC_BUTTON "button" #define MQTT_TOPIC_IP "ip" +#define MQTT_TOPIC_SSID "ssid" #define MQTT_TOPIC_VERSION "version" #define MQTT_TOPIC_UPTIME "uptime" #define MQTT_TOPIC_DATETIME "datetime" diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index baa9e9a8..cec21efc 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -184,6 +184,9 @@ void heartbeat() { #if (HEARTBEAT_REPORT_HOSTNAME) mqttSend(MQTT_TOPIC_HOSTNAME, getSetting("hostname").c_str()); #endif + #if (HEARTBEAT_REPORT_SSID) + mqttSend(MQTT_TOPIC_SSID, WiFi.SSID().c_str()); + #endif #if (HEARTBEAT_REPORT_IP) mqttSend(MQTT_TOPIC_IP, getIP().c_str()); #endif