ESPHome 2026.1.0-dev
Loading...
Searching...
No Matches
gree_switch.cpp
Go to the documentation of this file.
1#include "gree_switch.h"
2#include "esphome/core/log.h"
3
4namespace esphome {
5namespace gree {
6
7static const char *const TAG = "gree.switch";
8
10 auto initial = this->get_initial_state_with_restore_mode();
11 if (initial.has_value()) {
12 this->write_state(*initial);
13 }
14}
15
16void GreeModeBitSwitch::dump_config() { log_switch(TAG, " ", this->name_, this); }
17
19 this->parent_->set_mode_bit(this->bit_mask_, state);
20 this->publish_state(state);
21}
22
23} // namespace gree
24} // namespace esphome
void write_state(bool state) override
void publish_state(bool state)
Publish a state to the front-end from the back-end.
Definition switch.cpp:57
optional< bool > get_initial_state_with_restore_mode()
Returns the initial state of the switch, after applying restore mode rules.
Definition switch.cpp:43
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7