|
ESPHome 2026.11.0b6
|
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. | |
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 |
| using esphome::mqtt::mqtt_on_connect_callback_t = std::function<MQTTBackend::on_connect_callback_t> |
Callback for MQTT events.
Definition at line 55 of file mqtt_client.h.
| using esphome::mqtt::mqtt_on_disconnect_callback_t = std::function<MQTTBackend::on_disconnect_callback_t> |
Definition at line 56 of file mqtt_client.h.
| 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.
| 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.
|
strong |
Definition at line 11 of file mqtt_backend.h.
| 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.
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.
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.
| enum esphome::mqtt::MqttQueueTypeT : uint8_t |
| 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.
|
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.
|
strong |
| Enumerator | |
|---|---|
| SUBACK_TALLY_PENDING | |
| SUBACK_TALLY_ALL_GRANTED | |
| SUBACK_TALLY_NOT_ALL_GRANTED | |
Definition at line 30 of file mqtt_subscription_fingerprint.h.
|
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.
|
inline |
Definition at line 28 of file mqtt_component.cpp.
|
inline |
Definition at line 23 of file mqtt_component.cpp.
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.alarm_control_panel" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.binary_sensor" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.button" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.climate" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.component" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.cover" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.custom" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.datetime" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.datetime.datetime" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.datetime.time" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.event" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.fan" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.light" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.lock" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.number" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.select" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.sensor" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.switch" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.text" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.text_sensor" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.update" | ) |
| esphome::mqtt::ESPHOME_LOG_TAG | ( | TAG | , |
| "mqtt.valve" | ) |
| 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.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTAlarmControlPanelComponent | , |
| "alarm_control_panel" | ) const |
Definition at line 116 of file mqtt_alarm_control_panel.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTBinarySensorComponent | , |
| "binary_sensor" | ) const |
Definition at line 13 of file mqtt_binary_sensor.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTClimateComponent | , |
| "climate" | ) const |
Definition at line 301 of file mqtt_climate.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTCoverComponent | , |
| "cover" | ) const |
Definition at line 137 of file mqtt_cover.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTDateComponent | , |
| "date" | ) const |
Definition at line 39 of file mqtt_date.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTDateTimeComponent | , |
| "datetime" | ) const |
Definition at line 50 of file mqtt_datetime.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTFanComponent | , |
| "fan" | ) const |
Definition at line 27 of file mqtt_fan.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTJSONLightComponent | , |
| "light" | ) const |
Definition at line 17 of file mqtt_light.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTLockComponent | , |
| "lock" | ) const |
Definition at line 36 of file mqtt_lock.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTNumberComponent | , |
| "number" | ) const |
Definition at line 37 of file mqtt_number.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTSelectComponent | , |
| "select" | ) const |
Definition at line 28 of file mqtt_select.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTSensorComponent | , |
| "sensor" | ) const |
Definition at line 34 of file mqtt_sensor.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTSwitchComponent | , |
| "switch" | ) const |
Definition at line 41 of file mqtt_switch.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTTextComponent | , |
| "text" | ) const |
Definition at line 33 of file mqtt_text.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTTimeComponent | , |
| "time" | ) const |
Definition at line 39 of file mqtt_time.cpp.
| esphome::mqtt::MQTT_COMPONENT_TYPE | ( | MQTTValveComponent | , |
| "valve" | ) const |
Definition at line 78 of file mqtt_valve.cpp.
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | AlarmMqttStateStrings | , |
| "disarmed" | , | ||
| "armed_home" | , | ||
| "armed_away" | , | ||
| "armed_night" | , | ||
| "armed_vacation" | , | ||
| "armed_custom_bypass" | , | ||
| "pending" | , | ||
| "arming" | , | ||
| "disarming" | , | ||
| "triggered" | , | ||
| "unknown" | ) |
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | ClimateMqttActionStrings | , |
| "off" | , | ||
| "unknown" | , | ||
| "cooling" | , | ||
| "heating" | , | ||
| "idle" | , | ||
| "drying" | , | ||
| "fan" | , | ||
| "defrosting" | , | ||
| "unknown" | ) |
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | ClimateMqttFanModeStrings | , |
| "on" | , | ||
| "off" | , | ||
| "auto" | , | ||
| "low" | , | ||
| "medium" | , | ||
| "high" | , | ||
| "middle" | , | ||
| "focus" | , | ||
| "diffuse" | , | ||
| "quiet" | , | ||
| "unknown" | ) |
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | ClimateMqttModeStrings | , |
| "off" | , | ||
| "heat_cool" | , | ||
| "cool" | , | ||
| "heat" | , | ||
| "fan_only" | , | ||
| "dry" | , | ||
| "auto" | , | ||
| "unknown" | ) |
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | ClimateMqttPresetStrings | , |
| "none" | , | ||
| "home" | , | ||
| "away" | , | ||
| "boost" | , | ||
| "comfort" | , | ||
| "eco" | , | ||
| "sleep" | , | ||
| "activity" | , | ||
| "unknown" | ) |
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | ClimateMqttSwingModeStrings | , |
| "off" | , | ||
| "both" | , | ||
| "vertical" | , | ||
| "horizontal" | , | ||
| "unknown" | ) |
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | EntityCategoryMqttStrings | , |
| "" | , | ||
| "config" | , | ||
| "diagnostic" | ) |
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | NumberMqttModeStrings | , |
| "" | , | ||
| "box" | , | ||
| "slider" | ) |
| esphome::mqtt::PROGMEM_STRING_TABLE | ( | TextMqttModeStrings | , |
| "text" | , | ||
| "password" | ) |
| 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.
|
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.
|
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.
| MQTTTopicSource esphome::mqtt::static_topic | ( | const char * | topic | ) |
A topic string that outlives the subscription, such as a literal; it is referenced, not copied.
|
constexpr |
Whether one more SUBSCRIBE fits; wrap safe.
Definition at line 73 of file mqtt_subscription_fingerprint.h.
|
constexpr |
True when a SUBACK return code grants the subscription.
Definition at line 28 of file mqtt_subscription_fingerprint.h.
|
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.
|
extern |
| pass the lambda directly Removed esphome::mqtt::in |
Definition at line 62 of file mqtt_client.h.