ESPHome 2026.3.0
Loading...
Searching...
No Matches
micronova_number.cpp
Go to the documentation of this file.
1#include "micronova_number.h"
2
3namespace esphome::micronova {
4
5static const char *const TAG = "micronova.number";
6
8 LOG_NUMBER("", "Micronova number", 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_value = static_cast<float>(value_from_stove);
19 if (this->use_step_scaling_) {
20 new_value *= this->traits.get_step();
21 }
22 this->publish_state(new_value);
23}
24
25void MicroNovaNumber::control(float value) {
26 uint8_t new_number;
27 if (this->use_step_scaling_) {
28 new_number = static_cast<uint8_t>(value / this->traits.get_step());
29 } else {
30 new_number = static_cast<uint8_t>(value);
31 }
32 this->micronova_->queue_write_command(this->memory_location_, this->memory_address_, new_number);
33}
34
35} // namespace esphome::micronova
bool queue_write_command(uint8_t location, uint8_t address, uint8_t data)
Queue a write command to the stove (processed before reads)
void control(float value) override
void process_value_from_stove(int value_from_stove) override
void publish_state(float state)
Definition number.cpp:22
NumberTraits traits
Definition number.h:39