ESPHome 2026.2.4
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
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
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7