ESPHome  2024.3.2
mqtt_text.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/defines.h"
4 
5 #ifdef USE_MQTT
6 #ifdef USE_TEXT
7 
9 #include "mqtt_component.h"
10 
11 namespace esphome {
12 namespace mqtt {
13 
15  public:
20  explicit MQTTTextComponent(text::Text *text);
21 
22  // ========== INTERNAL METHODS ==========
23  // (In most use cases you won't need these)
25  void setup() override;
26  void dump_config() override;
27 
28  void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
29 
30  bool send_initial_state() override;
31 
32  bool publish_state(const std::string &value);
33 
34  protected:
36  std::string component_type() const override;
37  const EntityBase *get_entity() const override;
38 
40 };
41 
42 } // namespace mqtt
43 } // namespace esphome
44 
45 #endif
46 #endif // USE_MQTT
MQTTTextComponent(text::Text *text)
Construct this MQTTTextComponent instance with the provided friendly_name and text.
Definition: mqtt_text.cpp:16
void setup() override
Override setup.
Definition: mqtt_text.cpp:18
Base-class for all text inputs.
Definition: text.h:24
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
Definition: mqtt_text.cpp:36
bool send_initial_state() override
Definition: mqtt_text.cpp:48
Simple Helper struct used for Home Assistant MQTT send_discovery().
const EntityBase * get_entity() const override
Definition: mqtt_text.cpp:34
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
std::string component_type() const override
Override for MQTTComponent, returns "text".
Definition: mqtt_text.cpp:33
bool publish_state(const std::string &value)
Definition: mqtt_text.cpp:55
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...