ESPHome 2025.10.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 {
5namespace bl0940 {
6
7static const char *const TAG = "bl0940.number";
8
10 float value = 0.0f;
11 if (this->restore_value_) {
13 if (!this->pref_.load(&value)) {
14 value = 0.0f;
15 }
16 }
17 this->publish_state(value);
18}
19
20void CalibrationNumber::control(float value) {
21 this->publish_state(value);
22 if (this->restore_value_)
23 this->pref_.save(&value);
24}
25
26void CalibrationNumber::dump_config() { LOG_NUMBER("", "Calibration Number", this); }
27
28} // namespace bl0940
29} // namespace esphome
bool save(const T *src)
Definition preferences.h:21
virtual ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)=0
uint32_t get_object_id_hash()
void publish_state(float state)
Definition number.cpp:30
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
ESPPreferences * global_preferences