12static const char *
const TAG =
"mqtt.update";
20 if (payload ==
"INSTALL") {
23 ESP_LOGW(TAG,
"'%s': Received unknown update payload: %s", this->
friendly_name().c_str(), payload.c_str());
44 root[
"schema"] =
"json";
52 LOG_MQTT_COMPONENT(
true,
true);
void status_momentary_warning(const std::string &name, uint32_t length=5000)
void defer(const std::string &name, std::function< void()> &&f)
Defer a callback to the next loop() call.
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.
virtual std::string friendly_name() const
Get the friendly name of this MQTT component.
std::string get_state_topic_() const
Get the MQTT topic that new states will be shared to.
std::string get_command_topic_() const
Get the MQTT topic for listening to commands.
void subscribe(const std::string &topic, mqtt_callback_t callback, uint8_t qos=0)
Subscribe to a MQTT topic.
MQTTUpdateComponent(update::UpdateEntity *update)
std::string component_type() const override
"update" component type.
void dump_config() override
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
bool send_initial_state() override
update::UpdateEntity * update_
const EntityBase * get_entity() const override
void add_on_state_callback(std::function< void()> &&callback)
const UpdateInfo & update_info
constexpr const char *const MQTT_PAYLOAD_INSTALL
Providing packet encoding functions for exchanging data with a remote host.
Simple Helper struct used for Home Assistant MQTT send_discovery().
std::string current_version
std::string latest_version