ESPHome  2022.6.2
nextion_textsensor.h
Go to the documentation of this file.
1 #pragma once
4 #include "../nextion_component.h"
5 #include "../nextion_base.h"
6 
7 namespace esphome {
8 namespace nextion {
9 class NextionTextSensor;
10 
12  public:
13  NextionTextSensor(NextionBase *nextion) { this->nextion_ = nextion; }
14  void update() override;
15  void update_component() override { this->update(); }
16  void on_state_changed(const std::string &state);
17 
18  void process_text(const std::string &variable_name, const std::string &text_value) override;
19 
20  void set_state(const std::string &state, bool publish) override { this->set_state(state, publish, true); }
21  void set_state(const std::string &state) override { this->set_state(state, true, true); }
22  void set_state(const std::string &state, bool publish, bool send_to_nextion) override;
23 
24  void send_state_to_nextion() override { this->set_state(this->state, false, true); };
26  void set_state_from_int(int state_value, bool publish, bool send_to_nextion) override {}
27  void set_state_from_string(const std::string &state_value, bool publish, bool send_to_nextion) override {
28  this->set_state(state_value, publish, send_to_nextion);
29  }
30 };
31 } // namespace nextion
32 } // namespace esphome
void set_state_from_string(const std::string &state_value, bool publish, bool send_to_nextion) override
void on_state_changed(const std::string &state)
void set_state(const std::string &state) override
void set_state(const std::string &state, bool publish) override
NextionQueueType get_queue_type() override
This class simplifies creating components that periodically check a state.
Definition: component.h:266
void set_state_from_int(int state_value, bool publish, bool send_to_nextion) override
Definition: a4988.cpp:4
void process_text(const std::string &variable_name, const std::string &text_value) override