mirror of
https://github.com/esphome/esphome.git
synced 2026-10-17 03:32:50 +00:00
16 lines
464 B
C++
16 lines
464 B
C++
#include "output_switch.h"
|
|
#include "esphome/core/log.h"
|
|
|
|
namespace esphome::output {
|
|
|
|
static const char *const TAG = "output.switch";
|
|
|
|
void OutputSwitch::dump_config() { LOG_SWITCH("", "Output Switch", this); }
|
|
void OutputSwitch::setup() { this->control(this->get_initial_state_with_restore_mode().value_or(false)); }
|
|
void OutputSwitch::write_state(bool state) {
|
|
this->output_->set_state(state);
|
|
this->publish_state(state);
|
|
}
|
|
|
|
} // namespace esphome::output
|