ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::mqtt Namespace Reference

Data Structures

struct  Availability
 Simple data struct for Home Assistant component availability. More...
 
class  CustomMQTTDevice
 This class is a helper class for custom components that communicate using MQTT. More...
 
class  DispatchGuard
 Sets a flag for the guard's scope and restores its previous value on exit. More...
 
struct  Event
 
class  MQTTAlarmControlPanelComponent
 
class  MQTTBackend
 
class  MQTTBackendESP32
 
class  MQTTBackendESP8266
 
class  MQTTBackendLibreTiny
 
class  MQTTBinarySensorComponent
 
class  MQTTButtonComponent
 
class  MQTTClientComponent
 
class  MQTTClimateComponent
 
class  MQTTComponent
 MQTTComponent is the base class for all components that interact with MQTT to expose certain functionality or data from actuators or sensors to clients. More...
 
class  MQTTCoverComponent
 
struct  MQTTCredentials
 internal struct for MQTT credentials. More...
 
class  MQTTDateComponent
 
class  MQTTDateTimeComponent
 
struct  MQTTDiscoveryInfo
 Internal struct for MQTT Home Assistant discovery. More...
 
class  MQTTEventComponent
 
class  MQTTFanComponent
 
class  MQTTJSONLightComponent
 
class  MQTTLockComponent
 
struct  MQTTMessage
 internal struct for MQTT messages. More...
 
class  MQTTNumberComponent
 
class  MQTTPublishJsonAction
 
class  MQTTSelectComponent
 
class  MQTTSensorComponent
 
struct  MQTTSubscription
 internal struct for MQTT subscriptions. More...
 
class  MQTTSwitchComponent
 
class  MQTTTextComponent
 
class  MQTTTextSensor
 
class  MQTTTimeComponent
 
struct  MQTTTopicSource
 Where a subscription's topic comes from. The topic is rebuilt whenever it is needed, so nothing is stored. More...
 
class  MQTTUpdateComponent
 
class  MQTTValveComponent
 
struct  QueueElement
 
struct  SendDiscoveryConfig
 Simple Helper struct used for Home Assistant MQTT send_discovery(). More...
 
class  SubackCounter
 SUBACKs received on the current connection. More...
 

Typedefs

using mqtt_on_connect_callback_t = std::function<MQTTBackend::on_connect_callback_t>
 Callback for MQTT events.
 
using mqtt_on_disconnect_callback_t = std::function<MQTTBackend::on_disconnect_callback_t>
 
using mqtt_subscription_callback_t = Callback<void(const std::string &, const std::string &)>
 Stored callback of an MQTT subscription: the topic, then the payload.
 
using 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 class  MQTTClientDisconnectReason : int8_t {
  TCP_DISCONNECTED = 0 , MQTT_UNACCEPTABLE_PROTOCOL_VERSION = 1 , MQTT_IDENTIFIER_REJECTED = 2 , MQTT_SERVER_UNAVAILABLE = 3 ,
  MQTT_MALFORMED_CREDENTIALS = 4 , MQTT_NOT_AUTHORIZED = 5 , ESP8266_NOT_ENOUGH_SPACE = 6 , TLS_BAD_FINGERPRINT = 7 ,
  DNS_RESOLVE_ERROR = 8
}
 
enum class  MQTTTransport : uint8_t { MQTT_TRANSPORT_TCP = 0 , MQTT_TRANSPORT_WS = 1 , MQTT_TRANSPORT_WSS = 2 }
 Transport for the broker connection; only the ESP-IDF backend supports WebSocket. More...
 
enum  MqttQueueTypeT : uint8_t { MQTT_QUEUE_TYPE_NONE = 0 , MQTT_QUEUE_TYPE_SUBSCRIBE , MQTT_QUEUE_TYPE_UNSUBSCRIBE , MQTT_QUEUE_TYPE_PUBLISH }
 
enum  MQTTDiscoveryUniqueIdGenerator { MQTT_LEGACY_UNIQUE_ID_GENERATOR = 0 , MQTT_MAC_ADDRESS_UNIQUE_ID_GENERATOR }
 available discovery unique_id generators More...
 
enum  MQTTDiscoveryObjectIdGenerator { MQTT_NONE_OBJECT_ID_GENERATOR = 0 , MQTT_DEVICE_NAME_OBJECT_ID_GENERATOR }
 available discovery object_id generators More...
 
enum  MQTTClientState {
  MQTT_CLIENT_DISABLED = 0 , MQTT_CLIENT_DISCONNECTED , MQTT_CLIENT_RESOLVING_ADDRESS , MQTT_CLIENT_CONNECTING ,
  MQTT_CLIENT_CONNECTED
}
 
enum class  SubackTally : uint8_t { SUBACK_TALLY_PENDING , SUBACK_TALLY_ALL_GRANTED , SUBACK_TALLY_NOT_ALL_GRANTED }
 

Functions

 ESPHOME_LOG_TAG (TAG, "mqtt.custom")
 
 ESPHOME_LOG_TAG (TAG, "mqtt.alarm_control_panel")
 
 PROGMEM_STRING_TABLE (AlarmMqttStateStrings, "disarmed", "armed_home", "armed_away", "armed_night", "armed_vacation", "armed_custom_bypass", "pending", "arming", "disarming", "triggered", "unknown")
 
 MQTT_COMPONENT_TYPE (MQTTAlarmControlPanelComponent, "alarm_control_panel") const EntityBase *MQTTAlarmControlPanelComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt")
 
 ESPHOME_LOG_TAG (TAG, "mqtt.binary_sensor")
 
 MQTT_COMPONENT_TYPE (MQTTBinarySensorComponent, "binary_sensor") const EntityBase *MQTTBinarySensorComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.button")
 
MQTTTopicSource static_topic (const char *topic)
 A topic string that outlives the subscription, such as a literal; it is referenced, not copied.
 
MQTTTopicSource progmem_topic (ProgmemStr topic)
 A topic in flash, copied into the buffer when needed, so at most MQTT_DEFAULT_TOPIC_MAX_LEN - 1 characters.
 
 ESPHOME_LOG_TAG (TAG, "mqtt.climate")
 
 PROGMEM_STRING_TABLE (ClimateMqttModeStrings, "off", "heat_cool", "cool", "heat", "fan_only", "dry", "auto", "unknown")
 
 PROGMEM_STRING_TABLE (ClimateMqttActionStrings, "off", "unknown", "cooling", "heating", "idle", "drying", "fan", "defrosting", "unknown")
 
 PROGMEM_STRING_TABLE (ClimateMqttFanModeStrings, "on", "off", "auto", "low", "medium", "high", "middle", "focus", "diffuse", "quiet", "unknown")
 
 PROGMEM_STRING_TABLE (ClimateMqttSwingModeStrings, "off", "both", "vertical", "horizontal", "unknown")
 
 PROGMEM_STRING_TABLE (ClimateMqttPresetStrings, "none", "home", "away", "boost", "comfort", "eco", "sleep", "activity", "unknown")
 
 MQTT_COMPONENT_TYPE (MQTTClimateComponent, "climate") const EntityBase *MQTTClimateComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.component")
 
 PROGMEM_STRING_TABLE (EntityCategoryMqttStrings, "", "config", "diagnostic")
 
char * append_str (char *p, const char *s, size_t len)
 
char * append_char (char *p, char c)
 
void log_mqtt_component (const char *tag, MQTTComponent *obj, bool state_topic, bool command_topic)
 
 ESPHOME_LOG_TAG (TAG, "mqtt.cover")
 
 MQTT_COMPONENT_TYPE (MQTTCoverComponent, "cover") const EntityBase *MQTTCoverComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.datetime")
 
 MQTT_COMPONENT_TYPE (MQTTDateComponent, "date") const EntityBase *MQTTDateComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.datetime.datetime")
 
 MQTT_COMPONENT_TYPE (MQTTDateTimeComponent, "datetime") const EntityBase *MQTTDateTimeComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.event")
 
 ESPHOME_LOG_TAG (TAG, "mqtt.fan")
 
 MQTT_COMPONENT_TYPE (MQTTFanComponent, "fan") const EntityBase *MQTTFanComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.light")
 
 MQTT_COMPONENT_TYPE (MQTTJSONLightComponent, "light") const EntityBase *MQTTJSONLightComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.lock")
 
 MQTT_COMPONENT_TYPE (MQTTLockComponent, "lock") const EntityBase *MQTTLockComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.number")
 
 PROGMEM_STRING_TABLE (NumberMqttModeStrings, "", "box", "slider")
 
 MQTT_COMPONENT_TYPE (MQTTNumberComponent, "number") const EntityBase *MQTTNumberComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.select")
 
 MQTT_COMPONENT_TYPE (MQTTSelectComponent, "select") const EntityBase *MQTTSelectComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.sensor")
 
 MQTT_COMPONENT_TYPE (MQTTSensorComponent, "sensor") const EntityBase *MQTTSensorComponent
 
uint32_t add_subscription_fingerprint (uint32_t fingerprint, const char *topic, uint8_t qos)
 Adds one subscription to a fingerprint of a set of subscriptions; the order they are added in does not matter.
 
constexpr bool session_has_subscriptions (bool session_present, uint32_t trusted, uint32_t current)
 True when a resumed session holds in full the subscriptions it is trusted with, and they are the current ones.
 
constexpr bool subscribe_granted (uint8_t return_code)
 True when a SUBACK return code grants the subscription.
 
constexpr bool subscribe_fits (uint16_t sent, uint16_t answered, size_t free_slots, size_t slots_per_subscribe=INBOUND_SLOTS_PER_SUBSCRIBE)
 Whether one more SUBSCRIBE fits; wrap safe.
 
constexpr uint16_t rebase_sent (uint16_t sent, uint16_t answered)
 The sent count raised to the SUBACKs counted, so stray SUBACKs give no credit; wrap safe.
 
 ESPHOME_LOG_TAG (TAG, "mqtt.switch")
 
 MQTT_COMPONENT_TYPE (MQTTSwitchComponent, "switch") const EntityBase *MQTTSwitchComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.text")
 
 PROGMEM_STRING_TABLE (TextMqttModeStrings, "text", "password")
 
 MQTT_COMPONENT_TYPE (MQTTTextComponent, "text") const EntityBase *MQTTTextComponent
 
 ESPHOME_LOG_TAG (TAG, "mqtt.text_sensor")
 
 ESPHOME_LOG_TAG (TAG, "mqtt.datetime.time")
 
 MQTT_COMPONENT_TYPE (MQTTTimeComponent, "time") const EntityBase *MQTTTimeComponent
 
bool topic_match (const char *message, const char *subscription)
 True if the message topic matches the subscription, with + and # wildcards.
 
 ESPHOME_LOG_TAG (TAG, "mqtt.update")
 
 ESPHOME_LOG_TAG (TAG, "mqtt.valve")
 
 MQTT_COMPONENT_TYPE (MQTTValveComponent, "valve") const EntityBase *MQTTValveComponent
 

Variables

pass the lambda directly Removed in
 
MQTTClientComponent * global_mqtt_client
 

Typedef Documentation

◆ mqtt_on_connect_callback_t

Callback for MQTT events.

Definition at line 55 of file mqtt_client.h.

◆ mqtt_on_disconnect_callback_t

◆ mqtt_subscription_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.

Definition at line 59 of file mqtt_client.h.

◆ mqtt_topic_builder_t

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.

Never a null c_str(); an empty topic is "".

Definition at line 70 of file mqtt_client.h.

Enumeration Type Documentation

◆ MQTTClientDisconnectReason

enum class esphome::mqtt::MQTTClientDisconnectReason : int8_t
strong
Enumerator
TCP_DISCONNECTED 
MQTT_UNACCEPTABLE_PROTOCOL_VERSION 
MQTT_IDENTIFIER_REJECTED 
MQTT_SERVER_UNAVAILABLE 
MQTT_MALFORMED_CREDENTIALS 
MQTT_NOT_AUTHORIZED 
ESP8266_NOT_ENOUGH_SPACE 
TLS_BAD_FINGERPRINT 
DNS_RESOLVE_ERROR 

Definition at line 11 of file mqtt_backend.h.

◆ MQTTClientState

Enumerator
MQTT_CLIENT_DISABLED 
MQTT_CLIENT_DISCONNECTED 
MQTT_CLIENT_RESOLVING_ADDRESS 
MQTT_CLIENT_CONNECTING 
MQTT_CLIENT_CONNECTED 

Definition at line 139 of file mqtt_client.h.

◆ MQTTDiscoveryObjectIdGenerator

available discovery object_id generators

Enumerator
MQTT_NONE_OBJECT_ID_GENERATOR 
MQTT_DEVICE_NAME_OBJECT_ID_GENERATOR 

Definition at line 121 of file mqtt_client.h.

◆ MQTTDiscoveryUniqueIdGenerator

available discovery unique_id generators

Enumerator
MQTT_LEGACY_UNIQUE_ID_GENERATOR 
MQTT_MAC_ADDRESS_UNIQUE_ID_GENERATOR 

Definition at line 115 of file mqtt_client.h.

◆ MqttQueueTypeT

Enumerator
MQTT_QUEUE_TYPE_NONE 
MQTT_QUEUE_TYPE_SUBSCRIBE 
MQTT_QUEUE_TYPE_UNSUBSCRIBE 
MQTT_QUEUE_TYPE_PUBLISH 

Definition at line 57 of file mqtt_backend_esp32.h.

◆ MQTTTransport

enum class esphome::mqtt::MQTTTransport : uint8_t
strong

Transport for the broker connection; only the ESP-IDF backend supports WebSocket.

Enumerator
MQTT_TRANSPORT_TCP 
MQTT_TRANSPORT_WS 
MQTT_TRANSPORT_WSS 

Definition at line 24 of file mqtt_backend.h.

◆ SubackTally

enum class esphome::mqtt::SubackTally : uint8_t
strong
Enumerator
SUBACK_TALLY_PENDING 
SUBACK_TALLY_ALL_GRANTED 
SUBACK_TALLY_NOT_ALL_GRANTED 

Definition at line 30 of file mqtt_subscription_fingerprint.h.

Function Documentation

◆ add_subscription_fingerprint()

uint32_t esphome::mqtt::add_subscription_fingerprint ( uint32_t fingerprint,
const char * topic,
uint8_t qos )
inline

Adds one subscription to a fingerprint of a set of subscriptions; the order they are added in does not matter.

Definition at line 12 of file mqtt_subscription_fingerprint.h.

◆ append_char()

char * esphome::mqtt::append_char ( char * p,
char c )
inline

Definition at line 28 of file mqtt_component.cpp.

◆ append_str()

char * esphome::mqtt::append_str ( char * p,
const char * s,
size_t len )
inline

Definition at line 23 of file mqtt_component.cpp.

◆ ESPHOME_LOG_TAG() [1/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt"  )

◆ ESPHOME_LOG_TAG() [2/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.alarm_control_panel"  )

◆ ESPHOME_LOG_TAG() [3/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.binary_sensor"  )

◆ ESPHOME_LOG_TAG() [4/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.button"  )

◆ ESPHOME_LOG_TAG() [5/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.climate"  )

◆ ESPHOME_LOG_TAG() [6/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.component"  )

◆ ESPHOME_LOG_TAG() [7/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.cover"  )

◆ ESPHOME_LOG_TAG() [8/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.custom"  )

◆ ESPHOME_LOG_TAG() [9/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.datetime"  )

◆ ESPHOME_LOG_TAG() [10/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.datetime.datetime"  )

◆ ESPHOME_LOG_TAG() [11/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.datetime.time"  )

◆ ESPHOME_LOG_TAG() [12/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.event"  )

◆ ESPHOME_LOG_TAG() [13/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.fan"  )

◆ ESPHOME_LOG_TAG() [14/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.light"  )

◆ ESPHOME_LOG_TAG() [15/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.lock"  )

◆ ESPHOME_LOG_TAG() [16/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.number"  )

◆ ESPHOME_LOG_TAG() [17/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.select"  )

◆ ESPHOME_LOG_TAG() [18/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.sensor"  )

◆ ESPHOME_LOG_TAG() [19/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.switch"  )

◆ ESPHOME_LOG_TAG() [20/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.text"  )

◆ ESPHOME_LOG_TAG() [21/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.text_sensor"  )

◆ ESPHOME_LOG_TAG() [22/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.update"  )

◆ ESPHOME_LOG_TAG() [23/23]

esphome::mqtt::ESPHOME_LOG_TAG ( TAG ,
"mqtt.valve"  )

◆ log_mqtt_component()

void esphome::mqtt::log_mqtt_component ( const char * tag,
MQTTComponent * obj,
bool state_topic,
bool command_topic )

Definition at line 42 of file mqtt_component.cpp.

◆ MQTT_COMPONENT_TYPE() [1/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTAlarmControlPanelComponent ,
"alarm_control_panel"  ) const

Definition at line 116 of file mqtt_alarm_control_panel.cpp.

◆ MQTT_COMPONENT_TYPE() [2/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTBinarySensorComponent ,
"binary_sensor"  ) const

Definition at line 13 of file mqtt_binary_sensor.cpp.

◆ MQTT_COMPONENT_TYPE() [3/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTClimateComponent ,
"climate"  ) const

Definition at line 301 of file mqtt_climate.cpp.

◆ MQTT_COMPONENT_TYPE() [4/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTCoverComponent ,
"cover"  ) const

Definition at line 137 of file mqtt_cover.cpp.

◆ MQTT_COMPONENT_TYPE() [5/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTDateComponent ,
"date"  ) const

Definition at line 39 of file mqtt_date.cpp.

◆ MQTT_COMPONENT_TYPE() [6/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTDateTimeComponent ,
"datetime"  ) const

Definition at line 50 of file mqtt_datetime.cpp.

◆ MQTT_COMPONENT_TYPE() [7/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTFanComponent ,
"fan"  ) const

Definition at line 27 of file mqtt_fan.cpp.

◆ MQTT_COMPONENT_TYPE() [8/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTJSONLightComponent ,
"light"  ) const

Definition at line 17 of file mqtt_light.cpp.

◆ MQTT_COMPONENT_TYPE() [9/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTLockComponent ,
"lock"  ) const

Definition at line 36 of file mqtt_lock.cpp.

◆ MQTT_COMPONENT_TYPE() [10/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTNumberComponent ,
"number"  ) const

Definition at line 37 of file mqtt_number.cpp.

◆ MQTT_COMPONENT_TYPE() [11/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTSelectComponent ,
"select"  ) const

Definition at line 28 of file mqtt_select.cpp.

◆ MQTT_COMPONENT_TYPE() [12/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTSensorComponent ,
"sensor"  ) const

Definition at line 34 of file mqtt_sensor.cpp.

◆ MQTT_COMPONENT_TYPE() [13/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTSwitchComponent ,
"switch"  ) const

Definition at line 41 of file mqtt_switch.cpp.

◆ MQTT_COMPONENT_TYPE() [14/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTTextComponent ,
"text"  ) const

Definition at line 33 of file mqtt_text.cpp.

◆ MQTT_COMPONENT_TYPE() [15/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTTimeComponent ,
"time"  ) const

Definition at line 39 of file mqtt_time.cpp.

◆ MQTT_COMPONENT_TYPE() [16/16]

esphome::mqtt::MQTT_COMPONENT_TYPE ( MQTTValveComponent ,
"valve"  ) const

Definition at line 78 of file mqtt_valve.cpp.

◆ PROGMEM_STRING_TABLE() [1/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( AlarmMqttStateStrings ,
"disarmed" ,
"armed_home" ,
"armed_away" ,
"armed_night" ,
"armed_vacation" ,
"armed_custom_bypass" ,
"pending" ,
"arming" ,
"disarming" ,
"triggered" ,
"unknown"  )

◆ PROGMEM_STRING_TABLE() [2/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( ClimateMqttActionStrings ,
"off" ,
"unknown" ,
"cooling" ,
"heating" ,
"idle" ,
"drying" ,
"fan" ,
"defrosting" ,
"unknown"  )

◆ PROGMEM_STRING_TABLE() [3/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( ClimateMqttFanModeStrings ,
"on" ,
"off" ,
"auto" ,
"low" ,
"medium" ,
"high" ,
"middle" ,
"focus" ,
"diffuse" ,
"quiet" ,
"unknown"  )

◆ PROGMEM_STRING_TABLE() [4/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( ClimateMqttModeStrings ,
"off" ,
"heat_cool" ,
"cool" ,
"heat" ,
"fan_only" ,
"dry" ,
"auto" ,
"unknown"  )

◆ PROGMEM_STRING_TABLE() [5/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( ClimateMqttPresetStrings ,
"none" ,
"home" ,
"away" ,
"boost" ,
"comfort" ,
"eco" ,
"sleep" ,
"activity" ,
"unknown"  )

◆ PROGMEM_STRING_TABLE() [6/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( ClimateMqttSwingModeStrings ,
"off" ,
"both" ,
"vertical" ,
"horizontal" ,
"unknown"  )

◆ PROGMEM_STRING_TABLE() [7/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( EntityCategoryMqttStrings ,
"" ,
"config" ,
"diagnostic"  )

◆ PROGMEM_STRING_TABLE() [8/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( NumberMqttModeStrings ,
"" ,
"box" ,
"slider"  )

◆ PROGMEM_STRING_TABLE() [9/9]

esphome::mqtt::PROGMEM_STRING_TABLE ( TextMqttModeStrings ,
"text" ,
"password"  )

◆ progmem_topic()

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.

◆ rebase_sent()

uint16_t esphome::mqtt::rebase_sent ( uint16_t sent,
uint16_t answered )
constexpr

The sent count raised to the SUBACKs counted, so stray SUBACKs give no credit; wrap safe.

Definition at line 81 of file mqtt_subscription_fingerprint.h.

◆ session_has_subscriptions()

bool esphome::mqtt::session_has_subscriptions ( bool session_present,
uint32_t trusted,
uint32_t current )
constexpr

True when a resumed session holds in full the subscriptions it is trusted with, and they are the current ones.

Definition at line 20 of file mqtt_subscription_fingerprint.h.

◆ static_topic()

MQTTTopicSource esphome::mqtt::static_topic ( const char * topic)

A topic string that outlives the subscription, such as a literal; it is referenced, not copied.

◆ subscribe_fits()

bool esphome::mqtt::subscribe_fits ( uint16_t sent,
uint16_t answered,
size_t free_slots,
size_t slots_per_subscribe = INBOUND_SLOTS_PER_SUBSCRIBE )
constexpr

Whether one more SUBSCRIBE fits; wrap safe.

Definition at line 73 of file mqtt_subscription_fingerprint.h.

◆ subscribe_granted()

bool esphome::mqtt::subscribe_granted ( uint8_t return_code)
constexpr

True when a SUBACK return code grants the subscription.

Definition at line 28 of file mqtt_subscription_fingerprint.h.

◆ topic_match()

bool esphome::mqtt::topic_match ( const char * message,
const char * subscription )
inline

True if the message topic matches the subscription, with + and # wildcards.

A loop on purpose: recursing per character overflowed the ESP32 loop task's stack on long topics.

Definition at line 7 of file mqtt_topic_match.h.

Variable Documentation

◆ global_mqtt_client

MQTTClientComponent* esphome::mqtt::global_mqtt_client
extern

◆ in

pass the lambda directly Removed esphome::mqtt::in

Definition at line 62 of file mqtt_client.h.