ESPHome  2024.11.1
micronova_sensor.cpp
Go to the documentation of this file.
1 #include "micronova_sensor.h"
2 
3 namespace esphome {
4 namespace micronova {
5 
6 void MicroNovaSensor::process_value_from_stove(int value_from_stove) {
7  if (value_from_stove == -1) {
8  this->publish_state(NAN);
9  return;
10  }
11 
12  float new_sensor_value = (float) value_from_stove;
13  switch (this->get_function()) {
15  new_sensor_value = new_sensor_value / 2;
16  break;
18  break;
20  new_sensor_value = new_sensor_value == 0 ? 0 : (new_sensor_value * 10) + this->fan_speed_offset_;
21  break;
23  new_sensor_value = new_sensor_value / 2;
24  break;
26  new_sensor_value = new_sensor_value / 10;
27  break;
28  default:
29  break;
30  }
31  this->publish_state(new_sensor_value);
32 }
33 
34 } // namespace micronova
35 } // namespace esphome
void publish_state(float state)
Publish a new state to the front-end.
Definition: sensor.cpp:39
void process_value_from_stove(int value_from_stove) override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7