mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 21:56:35 +00:00
Fix compile errors with HASP_USE_HA
This commit is contained in:
parent
3a0c77eb37
commit
3d37f84a4b
@ -171,7 +171,7 @@ static void mqtt_message_cb(char* topic, byte* payload, unsigned int length)
|
|||||||
} else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
|
} else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
|
||||||
if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) {
|
if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) {
|
||||||
mqtt_ha_register_auto_discovery(); // auto-discovery first
|
mqtt_ha_register_auto_discovery(); // auto-discovery first
|
||||||
dispatch_current_state(); // send the data
|
dispatch_current_state(TAG_MQTT); // send the data
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
@ -314,8 +314,13 @@ void mqttStart()
|
|||||||
|
|
||||||
/* Home Assistant auto-configuration */
|
/* Home Assistant auto-configuration */
|
||||||
#ifdef HASP_USE_HA
|
#ifdef HASP_USE_HA
|
||||||
if(mqttHAautodiscover) mqttSubscribeTo(F("hass/status"), mqttClientId);
|
if(mqttHAautodiscover) {
|
||||||
if(mqttHAautodiscover) mqttSubscribeTo(F("homeassistant/status"), mqttClientId);
|
char topic[64];
|
||||||
|
snprintf_P(topic, sizeof(topic), PSTR("hass/status"));
|
||||||
|
mqttSubscribeTo(topic);
|
||||||
|
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/status"));
|
||||||
|
mqttSubscribeTo(topic);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Force any subscribed clients to toggle offline/online when we first connect to
|
// Force any subscribed clients to toggle offline/online when we first connect to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user