ESPHome 2026.3.0
Loading...
Searching...
No Matches
micronova_sensor.cpp
Go to the documentation of this file.
1#include "micronova_sensor.h"
2
3namespace esphome::micronova {
4
5static const char *const TAG = "micronova.sensor";
6
8 LOG_SENSOR("", "Micronova sensor", this);
9 this->dump_base_config();
10}
11
13 if (value_from_stove == -1) {
14 this->publish_state(NAN);
15 return;
16 }
17
18 float new_sensor_value = static_cast<float>(value_from_stove);
19
20 // Fan speed has special calculation: value * 10 + offset (when non-zero)
21 if (this->is_fan_speed_) {
22 new_sensor_value = value_from_stove == 0 ? 0.0f : (new_sensor_value * 10) + this->fan_speed_offset_;
23 } else if (this->divisor_ > 1) {
24 new_sensor_value = new_sensor_value / this->divisor_;
25 }
26
27 this->publish_state(new_sensor_value);
28}
29
30} // 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:65