12 if (!restored.has_value()) {
13 ESP_LOGD(TAG,
"Couldn't restore state for OpenTherm switch '%s'", LOG_STR_ARG(this->
get_log_name()));
15 ESP_LOGD(TAG,
"Restored state for OpenTherm switch '%s': %d", LOG_STR_ARG(this->
get_log_name()), restored.value());
16 state = restored.value();
22 LOG_SWITCH(
"",
"OpenTherm Switch",
this);
23 ESP_LOGCONFIG(TAG,
" Current state: %d", this->
state);
const LogString * get_log_name() const
Get the name for a "%s" log argument (LOG_STR_ARG).
void dump_config() override
void write_state(bool state) override
bool state
The current reported state of the binary sensor.
void publish_state(bool state)
Publish a state to the front-end from the back-end.
optional< bool > get_initial_state_with_restore_mode()
Returns the initial state of the switch, after applying restore mode rules.
ESPHOME_LOG_TAG(TAG, "opentherm")