ESPHome
2026.8.0-dev
Loading...
Searching...
No Matches
esphome
components
pcm5122
switch
power_switch.cpp
Go to the documentation of this file.
1
#include "
power_switch.h
"
2
3
namespace
esphome::pcm5122
{
4
5
void
PCM5122PowerSwitch::write_state
(
bool
state
) {
6
bool
ok = (this->
mode_
==
PCM5122_POWER_SWITCH_MODE_STANDBY
) ? this->
parent_
->set_standby(state)
7
: this->
parent_
->set_powerdown(state);
8
if
(ok)
9
this->
publish_state
(state);
10
}
11
12
}
// namespace esphome::pcm5122
esphome::Parented< PCM5122 >::parent_
PCM5122 * parent_
Definition
helpers.h:1886
esphome::pcm5122::PCM5122PowerSwitch::write_state
void write_state(bool state) override
Definition
power_switch.cpp:5
esphome::pcm5122::PCM5122PowerSwitch::mode_
PCM5122PowerSwitchMode mode_
Definition
power_switch.h:21
esphome::switch_::Switch::publish_state
void publish_state(bool state)
Publish a state to the front-end from the back-end.
Definition
switch.cpp:56
state
bool state
Definition
fan.h:2
esphome::pcm5122
Definition
pcm5122.cpp:8
esphome::pcm5122::PCM5122_POWER_SWITCH_MODE_STANDBY
@ PCM5122_POWER_SWITCH_MODE_STANDBY
Definition
power_switch.h:10
power_switch.h
Generated by
1.12.0