ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
output_switch.cpp
Go to the documentation of this file.
1#include "output_switch.h"
2#include "esphome/core/log.h"
3
4namespace esphome::output {
5
6ESPHOME_LOG_TAG(TAG, "output.switch");
7
8void OutputSwitch::dump_config() { LOG_SWITCH("", "Output Switch", this); }
9void OutputSwitch::setup() { this->restore(false); }
11 this->output_->set_state(state);
12 this->publish_state(state);
13}
14
15} // namespace esphome::output
virtual void set_state(bool state)
Enable or disable this binary output.
void write_state(bool state) override
output::BinaryOutput * output_
void restore()
Drive the switch to the state its restore mode yields, through control(), so inversion and write_stat...
Definition switch.cpp:63
void publish_state(bool state)
Publish a state to the front-end from the back-end.
Definition switch.cpp:70
bool state
Definition fan.h:2
ESPHOME_LOG_TAG(TAG, "output.button")