ESPHome 2025.12.3
Loading...
Searching...
No Matches
micronova_number.cpp
Go to the documentation of this file.
1#include "micronova_number.h"
2
3namespace esphome::micronova {
4
5void MicroNovaNumber::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_value = static_cast<float>(value_from_stove);
12 if (this->use_step_scaling_) {
13 new_value *= this->traits.get_step();
14 }
15 this->publish_state(new_value);
16}
17
18void MicroNovaNumber::control(float value) {
19 uint8_t new_number;
20 if (this->use_step_scaling_) {
21 new_number = static_cast<uint8_t>(value / this->traits.get_step());
22 } else {
23 new_number = static_cast<uint8_t>(value);
24 }
25 this->micronova_->write_address(this->memory_location_, this->memory_address_, new_number);
27}
28
29} // namespace esphome::micronova
void write_address(uint8_t location, uint8_t address, uint8_t data)
void control(float value) override
void process_value_from_stove(int value_from_stove) override
void publish_state(float state)
Definition number.cpp:31
NumberTraits traits
Definition number.h:39