ESPHome 2025.5.0
Loading...
Searching...
No Matches
number.cpp
Go to the documentation of this file.
1#include "number.h"
2#include "esphome/core/log.h"
3
4namespace esphome {
5namespace number {
6
7static const char *const TAG = "number";
8
10 this->has_state_ = true;
11 this->state = state;
12 ESP_LOGD(TAG, "'%s': Sending state %f", this->get_name().c_str(), state);
13 this->state_callback_.call(state);
14}
15
16void Number::add_on_state_callback(std::function<void(float)> &&callback) {
17 this->state_callback_.add(std::move(callback));
18}
19
20} // namespace number
21} // namespace esphome
const StringRef & get_name() const
void publish_state(float state)
Definition number.cpp:9
void add_on_state_callback(std::function< void(float)> &&callback)
Definition number.cpp:16
CallbackManager< void(float)> state_callback_
Definition number.h:65
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7