ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
pipsolar_switch.h
Go to the documentation of this file.
1#pragma once
2
3#include "../pipsolar.h"
6
7namespace esphome::pipsolar {
8class Pipsolar;
9class PipsolarSwitch : public switch_::Switch, public Component {
10 public:
11 void set_parent(Pipsolar *parent) { this->parent_ = parent; }
12 void set_on_command(const char *command) { this->on_command_ = command; }
13 void set_off_command(const char *command) { this->off_command_ = command; }
15 void set_on_command(const std::string &command) = delete;
16 void set_off_command(const std::string &command) = delete;
17 void dump_config() override;
18
19 protected:
20 void write_state(bool state) override;
21 const char *on_command_{nullptr};
22 const char *off_command_{nullptr};
24};
25
26} // namespace esphome::pipsolar
void set_parent(Pipsolar *parent)
void set_off_command(const char *command)
void set_on_command(const std::string &command)=delete
Prevent accidental use of std::string which would dangle.
void set_off_command(const std::string &command)=delete
void write_state(bool state) override
void set_on_command(const char *command)
Base class for all switches.
Definition switch.h:38
bool state
The current reported state of the binary sensor.
Definition switch.h:55