From c780fabead9f67942503b167af05ca836c398d39 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Mon, 1 Mar 2021 04:29:53 +0100 Subject: [PATCH] Switch HA message order --- src/mqtt/hasp_mqtt_pubsubclient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mqtt/hasp_mqtt_pubsubclient.cpp b/src/mqtt/hasp_mqtt_pubsubclient.cpp index a485721b..3fe89dff 100644 --- a/src/mqtt/hasp_mqtt_pubsubclient.cpp +++ b/src/mqtt/hasp_mqtt_pubsubclient.cpp @@ -169,8 +169,8 @@ static void mqtt_message_cb(char* topic, byte* payload, unsigned int length) } else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) { - dispatch_current_state(); - mqtt_ha_register_auto_discovery(); + mqtt_ha_register_auto_discovery(); // auto-discovery first + dispatch_current_state(); // send the data } return;