diff --git a/src/svc/hasp_http.cpp b/src/svc/hasp_http.cpp
index d36dce51..b191b0e2 100644
--- a/src/svc/hasp_http.cpp
+++ b/src/svc/hasp_http.cpp
@@ -231,9 +231,12 @@ void webHandleRoot()
httpMessage += httpGetNodename();
httpMessage += F("
");
- httpMessage += F("");
+ httpMessage +=
+ F("");
+
httpMessage +=
F("");
+ httpMessage += F("");
httpMessage +=
F("");
@@ -972,8 +975,9 @@ void webHandleConfig()
httpMessage +=
F("");
- httpMessage +=
- F("");
+ // httpMessage +=
+ // F("");
#if HASP_USE_GPIO > 0
httpMessage +=
diff --git a/src/svc/hasp_mqtt.cpp b/src/svc/hasp_mqtt.cpp
index 6a863f7d..55f57fea 100644
--- a/src/svc/hasp_mqtt.cpp
+++ b/src/svc/hasp_mqtt.cpp
@@ -56,7 +56,8 @@ String mqttCommandTopic; // MQTT topic for incoming panel commands
// String mqttGroupTopic((char *)0);
char mqttNodeTopic[24];
char mqttGroupTopic[24];
-bool mqttEnabled;
+bool mqttEnabled = false;
+bool mqttHAautodiscover = false;
////////////////////////////////////////////////////////////////////////////////////////////////////
// These defaults may be overwritten with values saved by the web interface
@@ -173,6 +174,11 @@ void IRAM_ATTR mqtt_send_obj_attribute_str(uint8_t pageid, uint8_t btnid, const
// data);
}
+void mqtt_ha_send_config()
+{
+
+}
+
////////////////////////////////////////////////////////////////////////////////////////////////////
// Receive incoming messages
static void mqtt_message_cb(char * topic, byte * payload, unsigned int length)
@@ -198,6 +204,12 @@ static void mqtt_message_cb(char * topic, byte * payload, unsigned int length)
dispatch_topic_payload(topic, (const char *)payload);
return;
+ } else if(mqttHAautodiscover && topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
+ if(!strcasecmp_P((char *)payload, PSTR("online"))) {
+ mqtt_ha_send_config();
+ }
+ return;
+
} else {
// Other topic
Log.error(TAG_MQTT, F("Message received with invalid topic"));
@@ -332,6 +344,9 @@ void mqttStart()
mqttSubscribeTo(PSTR("%sbrightness/#"), mqttNodeTopic);
mqttSubscribeTo(PSTR("%sLWT"), mqttNodeTopic);
+ /* Home Assistant auto-configuration */
+ if(mqttHAautodiscover) mqttSubscribeTo(PSTR("homeassistant/status"), mqttClientId);
+
// Force any subscribed clients to toggle offline/online when we first connect to
// make sure we get a full panel refresh at power on. Sending offline,
// "online" will be sent by the mqttStatusTopic subscription action.