ESPHome 2026.1.4
Loading...
Searching...
No Matches
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::mqtt {
12
14 public:
16
17 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
18
19 void setup() override;
20
21 void dump_config() override;
22
23 bool publish_state(const std::string &value);
24
25 bool send_initial_state() override;
26
27 protected:
28 const char *component_type() const override;
29 const EntityBase *get_entity() const override;
30
32};
33
34} // namespace esphome::mqtt
35
36#endif
37#endif // USE_MQTT
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
const char * component_type() const 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
Simple Helper struct used for Home Assistant MQTT send_discovery().