ESPHome 2026.1.4
Loading...
Searching...
No Matches
mqtt_text.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_MQTT
6#ifdef USE_TEXT
7
9#include "mqtt_component.h"
10
11namespace esphome::mqtt {
12
14 public:
19 explicit MQTTTextComponent(text::Text *text);
20
21 // ========== INTERNAL METHODS ==========
22 // (In most use cases you won't need these)
24 void setup() override;
25 void dump_config() override;
26
27 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
28
29 bool send_initial_state() override;
30
31 bool publish_state(const std::string &value);
32
33 protected:
35 const char *component_type() const override;
36 const EntityBase *get_entity() const override;
37
39};
40
41} // namespace esphome::mqtt
42
43#endif
44#endif // USE_MQTT
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
void setup() override
Override setup.
Definition mqtt_text.cpp:17
const char * component_type() const override
Override for MQTTComponent, returns "text".
MQTTTextComponent(text::Text *text)
Construct this MQTTTextComponent instance with the provided friendly_name and text.
Definition mqtt_text.cpp:15
const EntityBase * get_entity() const override
bool publish_state(const std::string &value)
Definition mqtt_text.cpp:55
Base-class for all text inputs.
Definition text.h:24
Simple Helper struct used for Home Assistant MQTT send_discovery().