ESPHome  2024.9.2
mqtt_cover.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/defines.h"
4 #include "mqtt_component.h"
5 
6 #ifdef USE_MQTT
7 #ifdef USE_COVER
8 
10 
11 namespace esphome {
12 namespace mqtt {
13 
15  public:
16  explicit MQTTCoverComponent(cover::Cover *cover);
17 
18  void setup() override;
19  void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
20 
25 
26  bool send_initial_state() override;
27 
28  bool publish_state();
29 
30  void dump_config() override;
31 
32  protected:
33  std::string component_type() const override;
34  const EntityBase *get_entity() const override;
35 
37 };
38 
39 } // namespace mqtt
40 } // namespace esphome
41 
42 #endif
43 #endif // USE_MQTT
Base class for all cover devices.
Definition: cover.h:111
float tilt
Definition: cover.h:15
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
Definition: mqtt_cover.cpp:65
const EntityBase * get_entity() const override
Definition: mqtt_cover.cpp:87
std::string component_type() const override
Definition: mqtt_cover.cpp:86
state state bool send_initial_state() override
Definition: mqtt_cover.cpp:89
Simple Helper struct used for Home Assistant MQTT send_discovery().
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
float position
Definition: cover.h:14
MQTTCoverComponent(cover::Cover *cover)
Definition: mqtt_cover.cpp:16
MQTT_COMPONENT_CUSTOM_TOPIC(position, command) MQTT_COMPONENT_CUSTOM_TOPIC(position
bool state
Definition: fan.h:34
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...