mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-19 12:43:28 +02:00
Tuya improvements (#1491)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
#include "esphome/components/ethernet/ethernet_component.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#include "esphome/components/mqtt/mqtt_client.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_MDNS
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#include <ESPmDNS.h>
|
||||
@@ -41,6 +45,26 @@ bool network_is_connected() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool api_is_connected() {
|
||||
#ifdef USE_API
|
||||
if (api::global_api_server != nullptr) {
|
||||
return api::global_api_server->is_connected();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool mqtt_is_connected() {
|
||||
#ifdef USE_MQTT
|
||||
if (mqtt::global_mqtt_client != nullptr) {
|
||||
return mqtt::global_mqtt_client->is_connected();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
bool remote_is_connected() { return api_is_connected() || mqtt_is_connected(); }
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP8266) && defined(USE_MDNS)
|
||||
bool mdns_setup;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user