ESPHome 2025.5.2
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
mqtt_text_sensor.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_MQTT
6#ifdef USE_TEXT_SENSOR
7
9#include "mqtt_component.h"
10
11namespace esphome {
12namespace mqtt {
13
15 public:
17
18 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
19
20 void setup() override;
21
22 void dump_config() override;
23
24 bool publish_state(const std::string &value);
25
26 bool send_initial_state() override;
27
28 protected:
29 std::string component_type() const override;
30 const EntityBase *get_entity() const override;
31 std::string unique_id() override;
32
34};
35
36} // namespace mqtt
37} // namespace esphome
38
39#endif
40#endif // USE_MQTT
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
std::string component_type() const override
std::string unique_id() override
text_sensor::TextSensor * sensor_
bool publish_state(const std::string &value)
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
MQTTTextSensor(text_sensor::TextSensor *sensor)
const EntityBase * get_entity() const override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
Simple Helper struct used for Home Assistant MQTT send_discovery().