ESPHome
2026.5.0
Loading...
Searching...
No Matches
esphome
components
copy
switch
copy_switch.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/components/switch/switch.h
"
5
6
namespace
esphome::copy
{
7
8
class
CopySwitch
:
public
switch_::Switch
,
public
Component
{
9
public
:
10
void
set_source
(
switch_::Switch
*source) {
source_
= source; }
11
void
setup
()
override
;
12
void
dump_config
()
override
;
13
14
protected
:
15
void
write_state
(
bool
state
)
override
;
16
17
switch_::Switch
*
source_
;
18
};
19
20
}
// namespace esphome::copy
esphome::Component
Definition
component.h:145
esphome::copy::CopySwitch
Definition
copy_switch.h:8
esphome::copy::CopySwitch::source_
switch_::Switch * source_
Definition
copy_switch.h:17
esphome::copy::CopySwitch::dump_config
void dump_config() override
Definition
copy_switch.cpp:14
esphome::copy::CopySwitch::setup
void setup() override
Definition
copy_switch.cpp:8
esphome::copy::CopySwitch::set_source
void set_source(switch_::Switch *source)
Definition
copy_switch.h:10
esphome::copy::CopySwitch::write_state
void write_state(bool state) override
Definition
copy_switch.cpp:16
esphome::switch_::Switch
Base class for all switches.
Definition
switch.h:38
esphome::switch_::Switch::state
bool state
The current reported state of the binary sensor.
Definition
switch.h:55
component.h
esphome::copy
Definition
copy_binary_sensor.cpp:4
switch.h
Generated by
1.12.0