ESPHome  2022.12.8
mqtt_subscribe_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 
10 
11 namespace esphome {
12 namespace mqtt_subscribe {
13 
15  public:
16  void set_parent(mqtt::MQTTClientComponent *parent) { parent_ = parent; }
17  void set_topic(const std::string &topic) { topic_ = topic; }
18  void setup() override;
19  void dump_config() override;
20  float get_setup_priority() const override;
21 
22  void set_qos(uint8_t qos);
23 
24  protected:
26  std::string topic_;
27  uint8_t qos_{0};
28 };
29 
30 } // namespace mqtt_subscribe
31 } // namespace esphome
32 
33 #endif // USE_MQTT
void set_parent(mqtt::MQTTClientComponent *parent)
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:50