ESPHome  2025.2.0
micronova_switch.cpp
Go to the documentation of this file.
1 #include "micronova_switch.h"
2 
3 namespace esphome {
4 namespace micronova {
5 
7  switch (this->get_function()) {
9  if (state) {
10  // Only send power-on when current state is Off
11  if (this->micronova_->get_current_stove_state() == 0) {
13  this->publish_state(true);
14  } else {
15  ESP_LOGW(TAG, "Unable to turn stove on, invalid state: %d", micronova_->get_current_stove_state());
16  }
17  } else {
18  // don't send power-off when status is Off or Final cleaning
21  this->publish_state(false);
22  } else {
23  ESP_LOGW(TAG, "Unable to turn stove off, invalid state: %d", micronova_->get_current_stove_state());
24  }
25  }
26  this->micronova_->update();
27  break;
28 
29  default:
30  break;
31  }
32 }
33 
34 } // namespace micronova
35 } // namespace esphome
void write_address(uint8_t location, uint8_t address, uint8_t data)
Definition: micronova.cpp:118
void write_state(bool state) override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void publish_state(bool state)
Publish a state to the front-end from the back-end.
Definition: switch.cpp:47
bool state
Definition: fan.h:34