Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove to unsupported HASP_USE_HA #813

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/user_config_override-template.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
**************************************************/
//#define HASP_USE_MDNS 0 // Disable MDNS
//#define HASP_USE_CUSTOM 1 // Enable compilation of custom code from /src/custom
//#define HASP_USE_HA // Enable Home Assistant auto-discovery
//#define HASP_START_CONSOLE 0 // Disable starting of serial console at boot
//#define HASP_START_TELNET 0 // Disable starting of telnet service at boot
//#define HASP_START_HTTP 0 // Disable starting of web interface at boot
Expand Down
19 changes: 0 additions & 19 deletions src/mqtt/hasp_mqtt_esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,6 @@ static void mqtt_message_cb(const char* topic, byte* payload, unsigned int lengt
topic += strlen_P(mqttBroadcastCommandTopic.c_str()); // shorten Broadcast topic
#endif

#ifdef HASP_USE_HA
} else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) {
mqtt_ha_register_auto_discovery(); // auto-discovery first
dispatch_current_state(TAG_MQTT); // send the data
}
return;
#endif
} else if(topic == strstr(topic, mqttHassLwtTopic.c_str())) { // startsWith mqttGroupCommandTopic
String state = String((const char*)payload);
state.toLowerCase();
Expand Down Expand Up @@ -377,17 +369,6 @@ void onMqttConnect(esp_mqtt_client_handle_t client)
mqttSubscribeTo(mqttNodeCommandTopic + subtopic);
#endif

/* Home Assistant auto-configuration */
#ifdef HASP_USE_HA
if(mqttHAautodiscover) {
char topic[64];
snprintf_P(topic, sizeof(topic), PSTR("hass/status"));
mqttSubscribeTo(topic);
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/status"));
mqttSubscribeTo(topic);
}
#endif

mqttSubscribeTo(mqttHassLwtTopic);

// Force any subscribed clients to toggle offline/online when we first connect to
Expand Down
17 changes: 0 additions & 17 deletions src/mqtt/hasp_mqtt_paho_async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,6 @@ static void mqtt_message_cb(char* topic, char* payload, size_t length)
return;
#endif

#ifdef HASP_USE_HA
} else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) {
dispatch_mtx.lock();
dispatch_current_state(TAG_MQTT);
dispatch_mtx.unlock();
mqtt_ha_register_auto_discovery();
}
return;
#endif

} else {
// Other topic
LOG_ERROR(TAG_MQTT, F(D_MQTT_INVALID_TOPIC));
Expand Down Expand Up @@ -341,12 +330,6 @@ static void onConnect(void* context, MQTTAsync_successData* response)
mqtt_subscribe(mqtt_client, topic.c_str());
#endif

/* Home Assistant auto-configuration */
#ifdef HASP_USE_HA
topic = "homeassistant/status";
mqtt_subscribe(mqtt_client, topic.c_str());
#endif

mqttPublish(mqttLwtTopic.c_str(), "online", 6, true);

#if HASP_TARGET_PC
Expand Down
15 changes: 0 additions & 15 deletions src/mqtt/hasp_mqtt_paho_single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,6 @@ static void mqtt_message_cb(char* topic, char* payload, size_t length)
return;
#endif

#ifdef HASP_USE_HA
} else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) {
dispatch_current_state(TAG_MQTT);
mqtt_ha_register_auto_discovery();
}
return;
#endif

} else {
// Other topic
LOG_ERROR(TAG_MQTT, F(D_MQTT_INVALID_TOPIC));
Expand Down Expand Up @@ -282,12 +273,6 @@ static void onConnect(void* context)
mqtt_subscribe(mqtt_client, topic.c_str());
#endif

/* Home Assistant auto-configuration */
#ifdef HASP_USE_HA
topic = "homeassistant/status";
mqtt_subscribe(mqtt_client, topic.c_str());
#endif

mqttPublish(mqttLwtTopic.c_str(), "online", 6, true);
}

Expand Down
20 changes: 0 additions & 20 deletions src/mqtt/hasp_mqtt_pubsubclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,6 @@ static void mqtt_message_cb(char* topic, byte* payload, unsigned int length)
return;
#endif

#ifdef HASP_USE_HA
} else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) {
mqtt_ha_register_auto_discovery(); // auto-discovery first
dispatch_current_state(TAG_MQTT); // send the data
}
return;
#endif

} else {
// Other topic
LOG_ERROR(TAG_MQTT, F(D_MQTT_INVALID_TOPIC));
Expand Down Expand Up @@ -323,17 +314,6 @@ void mqttStart()
mqttSubscribeTo(topic);
#endif

/* Home Assistant auto-configuration */
#ifdef HASP_USE_HA
if(mqttHAautodiscover) {
char topic[64];
snprintf_P(topic, sizeof(topic), PSTR("hass/status"));
mqttSubscribeTo(topic);
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/status"));
mqttSubscribeTo(topic);
}
#endif

// 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.
Expand Down