mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 11:44:13 +01:00
0d1028be2e
Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
21 lines
517 B
C++
21 lines
517 B
C++
#include "number.h"
|
|
#include "esphome/core/log.h"
|
|
|
|
namespace esphome {
|
|
namespace number {
|
|
|
|
static const char *const TAG = "number";
|
|
|
|
void Number::publish_state(float state) {
|
|
this->has_state_ = true;
|
|
this->state = state;
|
|
ESP_LOGD(TAG, "'%s': Sending state %f", this->get_name().c_str(), state);
|
|
this->state_callback_.call(state);
|
|
}
|
|
|
|
void Number::add_on_state_callback(std::function<void(float)> &&callback) {
|
|
this->state_callback_.add(std::move(callback));
|
|
}
|
|
|
|
} // namespace number
|
|
} // namespace esphome
|