ESPHome  2024.12.2
mqtt_valve.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_VALVE
8 
10 
11 namespace esphome {
12 namespace mqtt {
13 
15  public:
16  explicit MQTTValveComponent(valve::Valve *valve);
17 
18  void setup() override;
19  void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
20 
23 
24  bool send_initial_state() override;
25 
26  bool publish_state();
27 
28  void dump_config() override;
29 
30  protected:
31  std::string component_type() const override;
32  const EntityBase *get_entity() const override;
33 
35 };
36 
37 } // namespace mqtt
38 } // namespace esphome
39 
40 #endif
41 #endif // USE_MQTT
MQTTValveComponent(valve::Valve *valve)
Definition: mqtt_valve.cpp:16
MQTT_COMPONENT_CUSTOM_TOPIC(position, command) MQTT_COMPONENT_CUSTOM_TOPIC(position
Simple Helper struct used for Home Assistant MQTT send_discovery().
state bool send_initial_state() override
Definition: mqtt_valve.cpp:66
const EntityBase * get_entity() const override
Definition: mqtt_valve.cpp:64
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
Definition: mqtt_valve.cpp:49
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base class for all valve devices.
Definition: valve.h:105
std::string component_type() const override
Definition: mqtt_valve.cpp:63
float position
Definition: cover.h:14
bool state
Definition: fan.h:34
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...