mirror of
https://github.com/esphome/esphome.git
synced 2026-08-31 10:06:03 +00:00
24 lines
505 B
C++
24 lines
505 B
C++
#include "esphome/core/util.h"
|
|
#include "esphome/core/application.h"
|
|
#include "esphome/core/version.h"
|
|
#include "esphome/core/log.h"
|
|
|
|
#ifdef USE_MQTT
|
|
#include "esphome/components/mqtt/mqtt_client.h"
|
|
#endif
|
|
|
|
namespace esphome {
|
|
|
|
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(); }
|
|
|
|
} // namespace esphome
|