ESPHome  2024.11.1
mqtt_text_sensor.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_SENSOR
7 
9 #include "mqtt_component.h"
10 
11 namespace esphome {
12 namespace 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
MQTTTextSensor(text_sensor::TextSensor *sensor)
std::string unique_id() override
bool publish_state(const std::string &value)
Simple Helper struct used for Home Assistant MQTT send_discovery().
const EntityBase * get_entity() const override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
text_sensor::TextSensor * sensor_
esphome::sensor::Sensor * sensor
Definition: statsd.h:38
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
std::string component_type() const override
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...