ESPHome  2022.6.3
pipsolar_switch.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../pipsolar.h"
6 
7 namespace esphome {
8 namespace pipsolar {
9 class Pipsolar;
10 class PipsolarSwitch : public switch_::Switch, public Component {
11  public:
12  void set_parent(Pipsolar *parent) { this->parent_ = parent; };
13  void set_on_command(const std::string &command) { this->on_command_ = command; };
14  void set_off_command(const std::string &command) { this->off_command_ = command; };
15  void dump_config() override;
16 
17  protected:
18  void write_state(bool state) override;
19  std::string on_command_;
20  std::string off_command_;
22 };
23 
24 } // namespace pipsolar
25 } // namespace esphome
Base class for all switches.
Definition: switch.h:33
void set_off_command(const std::string &command)
void set_on_command(const std::string &command)
Definition: a4988.cpp:4
void write_state(bool state) override
void set_parent(Pipsolar *parent)
bool state
The current reported state of the binary sensor.
Definition: switch.h:48