ESPHome
2026.3.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
{
6
namespace
pipsolar {
7
8
static
const
char
*
const
TAG =
"pipsolar.switch"
;
9
10
void
PipsolarSwitch::dump_config
() { LOG_SWITCH(
""
,
"Pipsolar Switch"
,
this
); }
11
void
PipsolarSwitch::write_state
(
bool
state
) {
12
const
char
*command =
state
? this->
on_command_
: this->
off_command_
;
13
if
(command !=
nullptr
) {
14
this->
parent_
->queue_command(command);
15
}
16
}
17
18
}
// namespace pipsolar
19
}
// namespace esphome
application.h
esphome::pipsolar::PipsolarSwitch::off_command_
const char * off_command_
Definition
pipsolar_switch.h:23
esphome::pipsolar::PipsolarSwitch::dump_config
void dump_config() override
Definition
pipsolar_switch.cpp:10
esphome::pipsolar::PipsolarSwitch::write_state
void write_state(bool state) override
Definition
pipsolar_switch.cpp:11
esphome::pipsolar::PipsolarSwitch::on_command_
const char * on_command_
Definition
pipsolar_switch.h:22
esphome::pipsolar::PipsolarSwitch::parent_
Pipsolar * parent_
Definition
pipsolar_switch.h:24
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
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
pipsolar_switch.h
Generated by
1.12.0