ESPHome 2026.1.0-dev
Loading...
Searching...
No Matches
micronova_sensor.cpp
Go to the documentation of this file.
1#include "micronova_sensor.h"
2
3namespace esphome::micronova {
4
5void MicroNovaSensor::process_value_from_stove(int value_from_stove) {
6 if (value_from_stove == -1) {
7 this->publish_state(NAN);
8 return;
9 }
10
11 float new_sensor_value = static_cast<float>(value_from_stove);
12
13 // Fan speed has special calculation: value * 10 + offset (when non-zero)
14 if (this->is_fan_speed_) {
15 new_sensor_value = value_from_stove == 0 ? 0.0f : (new_sensor_value * 10) + this->fan_speed_offset_;
16 } else if (this->divisor_ > 1) {
17 new_sensor_value = new_sensor_value / this->divisor_;
18 }
19
20 this->publish_state(new_sensor_value);
21}
22
23} // namespace esphome::micronova
void process_value_from_stove(int value_from_stove) override
void publish_state(float state)
Publish a new state to the front-end.
Definition sensor.cpp:77