ESPHome  2022.8.0
copy_switch.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 namespace esphome {
7 namespace copy {
8 
9 class CopySwitch : public switch_::Switch, public Component {
10  public:
11  void set_source(switch_::Switch *source) { source_ = source; }
12  void setup() override;
13  void dump_config() override;
14  float get_setup_priority() const override { return setup_priority::DATA; }
15 
16  protected:
17  void write_state(bool state) override;
18 
20 };
21 
22 } // namespace copy
23 } // namespace esphome
switch_::Switch * source_
Definition: copy_switch.h:19
Base class for all switches.
Definition: switch.h:33
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:18
void dump_config() override
Definition: copy_switch.cpp:15
float get_setup_priority() const override
Definition: copy_switch.h:14
void setup() override
Definition: copy_switch.cpp:9
void write_state(bool state) override
Definition: copy_switch.cpp:17
void set_source(switch_::Switch *source)
Definition: copy_switch.h:11
Definition: a4988.cpp:4
bool state
The current reported state of the binary sensor.
Definition: switch.h:48