ESPHome
2026.11.0-dev
Loading...
Searching...
No Matches
esphome
core
util.cpp
Go to the documentation of this file.
1
#include "
esphome/core/util.h
"
2
3
// Compiled only on MQTT builds (core FILTER_SOURCE_FILES); without USE_MQTT
4
// the header provides inline stubs and this file must stay empty, so the
5
// guard protects builds that compile every source, such as clang-tidy.
6
#ifdef USE_MQTT
7
#include "
esphome/components/mqtt/mqtt_client.h
"
8
9
namespace
esphome
{
10
11
bool
mqtt_is_connected
() {
return
mqtt::global_mqtt_client
!=
nullptr
&&
mqtt::global_mqtt_client
->
is_connected
(); }
12
13
bool
remote_is_connected
() {
return
api_is_connected
() ||
mqtt_is_connected
(); }
14
15
}
// namespace esphome
16
#endif
esphome::mqtt::MQTTClientComponent::is_connected
bool is_connected()
util.h
mqtt_client.h
esphome::mqtt::global_mqtt_client
MQTTClientComponent * global_mqtt_client
esphome
Definition
a01nyub.cpp:7
esphome::remote_is_connected
bool remote_is_connected()
Return whether the node has any form of "remote" connection via the API or to an MQTT broker.
Definition
util.cpp:13
esphome::api_is_connected
ESPHOME_ALWAYS_INLINE bool api_is_connected()
Return whether the node has at least one client connected to the native API.
Definition
util.h:20
esphome::mqtt_is_connected
bool mqtt_is_connected()
Return whether the node has an active connection to an MQTT broker.
Definition
util.cpp:11
Generated by
1.12.0