ESPHome
2026.6.0-dev
Loading...
Searching...
No Matches
esphome
components
pipsolar
switch
pipsolar_switch.cpp
Go to the documentation of this file.
1
#include "
pipsolar_switch.h
"
2
#include "
esphome/core/log.h
"
3
#include "
esphome/core/application.h
"
4
5
namespace
esphome::pipsolar
{
6
7
static
const
char
*
const
TAG =
"pipsolar.switch"
;
8
9
void
PipsolarSwitch::dump_config
() { LOG_SWITCH(
""
,
"Pipsolar Switch"
,
this
); }
10
void
PipsolarSwitch::write_state
(
bool
state
) {
11
const
char
*command =
state
? this->
on_command_
: this->
off_command_
;
12
if
(command !=
nullptr
) {
13
this->
parent_
->queue_command(command);
14
}
15
}
16
17
}
// namespace esphome::pipsolar
application.h
esphome::pipsolar::PipsolarSwitch::off_command_
const char * off_command_
Definition
pipsolar_switch.h:22
esphome::pipsolar::PipsolarSwitch::dump_config
void dump_config() override
Definition
pipsolar_switch.cpp:9
esphome::pipsolar::PipsolarSwitch::write_state
void write_state(bool state) override
Definition
pipsolar_switch.cpp:10
esphome::pipsolar::PipsolarSwitch::on_command_
const char * on_command_
Definition
pipsolar_switch.h:21
esphome::pipsolar::PipsolarSwitch::parent_
Pipsolar * parent_
Definition
pipsolar_switch.h:23
esphome::switch_::Switch::state
bool state
The current reported state of the binary sensor.
Definition
switch.h:55
state
bool state
Definition
fan.h:2
log.h
esphome::pipsolar
Definition
pipsolar_output.cpp:5
pipsolar_switch.h
Generated by
1.12.0