ESPHome
2026.5.0
Loading...
Searching...
No Matches
esphome
core
util.cpp
Go to the documentation of this file.
1
#include "
esphome/core/util.h
"
2
#include "
esphome/core/application.h
"
3
#include "
esphome/core/version.h
"
4
#include "
esphome/core/log.h
"
5
6
#ifdef USE_MQTT
7
#include "
esphome/components/mqtt/mqtt_client.h
"
8
#endif
9
10
namespace
esphome
{
11
12
bool
mqtt_is_connected
() {
13
#ifdef USE_MQTT
14
if
(
mqtt::global_mqtt_client
!=
nullptr
) {
15
return
mqtt::global_mqtt_client
->
is_connected
();
16
}
17
#endif
18
return
false
;
19
}
20
21
bool
remote_is_connected
() {
return
api_is_connected
() ||
mqtt_is_connected
(); }
22
23
}
// namespace esphome
application.h
esphome::mqtt::MQTTClientComponent::is_connected
bool is_connected()
util.h
log.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:21
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:12
version.h
Generated by
1.12.0