11static const char *
const TAG =
"mqtt.update";
19 if (payload ==
"INSTALL") {
22 ESP_LOGW(TAG,
"'%s': Received unknown update payload: %s", this->
friendly_name_().c_str(), payload.c_str());
31 char topic_buf[MQTT_DEFAULT_TOPIC_MAX_LEN];
45 root[ESPHOME_F(
"schema")] = ESPHOME_F(
"json");
46 root[MQTT_PAYLOAD_INSTALL] = ESPHOME_F(
"INSTALL");
53 LOG_MQTT_COMPONENT(
true,
true);
ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") void defer(const std voi defer)(const char *name, std::function< void()> &&f)
Defer a callback to the next loop() call.
void status_momentary_warning(const char *name, uint32_t length=5000)
Set warning status flag and automatically clear it after a timeout.
const StringRef & get_name() const
constexpr const char * c_str() const
bool publish_json(const std::string &topic, const json::json_build_t &f)
Construct and send a JSON MQTT message.
StringRef get_state_topic_to_(std::span< char, MQTT_DEFAULT_TOPIC_MAX_LEN > buf) const
Get the MQTT state topic into a buffer (no heap allocation for non-lambda custom topics).
const StringRef & friendly_name_() const
Get the friendly name of this MQTT component.
std::string get_command_topic_() const
Get the MQTT topic for listening to commands (allocates std::string).
void subscribe(const std::string &topic, mqtt_callback_t callback, uint8_t qos=0)
Subscribe to a MQTT topic.
MQTTUpdateComponent(update::UpdateEntity *update)
void dump_config() override
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
bool send_initial_state() override
update::UpdateEntity * update_
void add_on_state_callback(std::function< void()> &&callback)
const UpdateInfo & update_info
MQTT_COMPONENT_TYPE(MQTTAlarmControlPanelComponent, "alarm_control_panel") const EntityBase *MQTTAlarmControlPanelComponent
Simple Helper struct used for Home Assistant MQTT send_discovery().
std::string current_version
std::string latest_version