ESPHome  2024.5.4
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  } else {
17  // don't send power-off when status is Off or Final cleaning
20  this->publish_state(false);
21  } else
22  ESP_LOGW(TAG, "Unable to turn stove off, invalid state: %d", micronova_->get_current_stove_state());
23  }
24  this->micronova_->update();
25  break;
26 
27  default:
28  break;
29  }
30 }
31 
32 } // namespace micronova
33 } // namespace esphome
void write_address(uint8_t location, uint8_t address, uint8_t data)
Definition: micronova.cpp:118
void write_state(bool state) override
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
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