mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 12:33:10 +00:00
Add the C++ `final` specifier to leaf, user-configurable component classes and automation action/trigger/condition primitives so that classes meant to be terminal cannot be subclassed by external components. Only classes never used as a base anywhere in the tree are marked. Part 11 of 21, split alphabetically by component (microphone .. ms8607).
40 lines
874 B
C++
40 lines
874 B
C++
#pragma once
|
|
|
|
#include "esphome/core/defines.h"
|
|
|
|
#ifdef USE_MQTT
|
|
#ifdef USE_UPDATE
|
|
|
|
#include "esphome/components/update/update_entity.h"
|
|
#include "mqtt_component.h"
|
|
|
|
namespace esphome::mqtt {
|
|
|
|
class MQTTUpdateComponent final : public mqtt::MQTTComponent {
|
|
public:
|
|
explicit MQTTUpdateComponent(update::UpdateEntity *update);
|
|
|
|
// ========== INTERNAL METHODS ==========
|
|
// (In most use cases you won't need these)
|
|
void setup() override;
|
|
void dump_config() override;
|
|
|
|
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
|
|
|
|
bool send_initial_state() override;
|
|
|
|
bool publish_state();
|
|
|
|
protected:
|
|
/// "update" component type.
|
|
const char *component_type() const override;
|
|
const EntityBase *get_entity() const override;
|
|
|
|
update::UpdateEntity *update_;
|
|
};
|
|
|
|
} // namespace esphome::mqtt
|
|
|
|
#endif // USE_UPDATE
|
|
#endif // USE_MQTT
|