12 static 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);
std::string component_type() const override
"update" component type.
MQTTUpdateComponent(update::UpdateEntity *update)
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
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.
std::string latest_version
std::string current_version
bool publish_json(const std::string &topic, const json::json_build_t &f)
Construct and send a JSON MQTT message.
constexpr const char *const MQTT_PAYLOAD_INSTALL
const EntityBase * get_entity() const override
void dump_config() override
void subscribe(const std::string &topic, mqtt_callback_t callback, uint8_t qos=0)
Subscribe to a MQTT topic.
const UpdateInfo & update_info
bool send_initial_state() override
Simple Helper struct used for Home Assistant MQTT send_discovery().
void add_on_state_callback(std::function< void()> &&callback)
constexpr const char * c_str() const
virtual std::string friendly_name() const
Get the friendly name of this MQTT component.
Implementation of SPI Controller mode.
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.
update::UpdateEntity * update_
const StringRef & get_name() const