ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
mqtt_client.h File Reference

Go to the source code of this file.

Data Structures

struct  esphome::mqtt::MQTTTopicSource
 Where a subscription's topic comes from. The topic is rebuilt whenever it is needed, so nothing is stored. More...
 
struct  esphome::mqtt::MQTTSubscription
 internal struct for MQTT subscriptions. More...
 
struct  esphome::mqtt::MQTTCredentials
 internal struct for MQTT credentials. More...
 
struct  esphome::mqtt::Availability
 Simple data struct for Home Assistant component availability. More...
 
struct  esphome::mqtt::MQTTDiscoveryInfo
 Internal struct for MQTT Home Assistant discovery. More...
 
class  esphome::mqtt::MQTTClientComponent
 
class  esphome::mqtt::MQTTPublishJsonAction< Ts >
 

Namespaces

namespace  esphome
 
namespace  esphome::mqtt
 

Typedefs

using esphome::mqtt::mqtt_on_connect_callback_t = std::function<MQTTBackend::on_connect_callback_t>
 Callback for MQTT events.
 
using esphome::mqtt::mqtt_on_disconnect_callback_t = std::function<MQTTBackend::on_disconnect_callback_t>
 
using esphome::mqtt::mqtt_subscription_callback_t = Callback<void(const std::string &, const std::string &)>
 Stored callback of an MQTT subscription: the topic, then the payload.
 
using esphome::mqtt::mqtt_topic_builder_t = = std::function<void(const std::string &, JsonObject)> StringRef (*)(const void *context, std::span<char, MQTT_DEFAULT_TOPIC_MAX_LEN> buf)
 Returns a subscription's topic, written into buf or referring to storage that outlives the subscription.
 

Enumerations

enum  esphome::mqtt::MQTTDiscoveryUniqueIdGenerator { esphome::mqtt::MQTT_LEGACY_UNIQUE_ID_GENERATOR = 0 , esphome::mqtt::MQTT_MAC_ADDRESS_UNIQUE_ID_GENERATOR }
 available discovery unique_id generators More...
 
enum  esphome::mqtt::MQTTDiscoveryObjectIdGenerator { esphome::mqtt::MQTT_NONE_OBJECT_ID_GENERATOR = 0 , esphome::mqtt::MQTT_DEVICE_NAME_OBJECT_ID_GENERATOR }
 available discovery object_id generators More...
 
enum  esphome::mqtt::MQTTClientState {
  esphome::mqtt::MQTT_CLIENT_DISABLED = 0 , esphome::mqtt::MQTT_CLIENT_DISCONNECTED , esphome::mqtt::MQTT_CLIENT_RESOLVING_ADDRESS , esphome::mqtt::MQTT_CLIENT_CONNECTING ,
  esphome::mqtt::MQTT_CLIENT_CONNECTED
}
 

Functions

MQTTTopicSource esphome::mqtt::static_topic (const char *topic)
 A topic string that outlives the subscription, such as a literal; it is referenced, not copied.
 
MQTTTopicSource esphome::mqtt::progmem_topic (ProgmemStr topic)
 A topic in flash, copied into the buffer when needed, so at most MQTT_DEFAULT_TOPIC_MAX_LEN - 1 characters.
 

Variables

pass the lambda directly Removed esphome::mqtt::in
 
MQTTClientComponent * esphome::mqtt::global_mqtt_client