ESPHome 2026.3.0-dev
Loading...
Searching...
No Matches
mqtt_cover.h
Go to the documentation of this file.
1#pragma once
2
4#include "mqtt_component.h"
5
6#ifdef USE_MQTT
7#ifdef USE_COVER
8
10
11namespace esphome::mqtt {
12
14 public:
15 explicit MQTTCoverComponent(cover::Cover *cover);
16
17 void setup() override;
18 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
19
24
25 bool send_initial_state() override;
26
27 bool publish_state();
28
29 void dump_config() override;
30#ifdef USE_MQTT_COVER_JSON
31 void set_use_json_format(bool use_json_format) { this->use_json_format_ = use_json_format; }
32#endif
33
34 protected:
35 const char *component_type() const override;
36 const EntityBase *get_entity() const override;
37
39#ifdef USE_MQTT_COVER_JSON
40 bool use_json_format_{false};
41#endif
42};
43
44} // namespace esphome::mqtt
45
46#endif
47#endif // USE_MQTT
Base class for all cover devices.
Definition cover.h:110
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
state state bool send_initial_state() override
const char * component_type() const override
MQTTCoverComponent(cover::Cover *cover)
const EntityBase * get_entity() const override
MQTT_COMPONENT_CUSTOM_TOPIC(position, command) MQTT_COMPONENT_CUSTOM_TOPIC(position
void set_use_json_format(bool use_json_format)
Definition mqtt_cover.h:31
float position
Definition cover.h:0
float tilt
Definition cover.h:1
bool state
Definition fan.h:2
Simple Helper struct used for Home Assistant MQTT send_discovery().