ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
calibration_number.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
3
4namespace esphome::bl0940 {
5
6static const char *const TAG = "bl0940.number";
7
9 float value = 0.0f;
10 if (this->restore_value_) {
12 if (!this->pref_.load(&value)) {
13 value = 0.0f;
14 }
15 }
16 this->publish_state(value);
17}
18
19void CalibrationNumber::control(float value) {
20 this->publish_state(value);
21 if (this->restore_value_)
22 this->pref_.save(&value);
23}
24
25void CalibrationNumber::dump_config() { LOG_NUMBER("", "Calibration Number", this); }
26
27} // namespace esphome::bl0940
ESPPreferenceObject make_entity_preference(uint32_t version=0)
Create a preference object for storing this entity's state/settings.
void publish_state(float state)
Definition number.cpp:22