esphome/esphome/components/number/number.cpp
Maurice Makaay 0d1028be2e
Cleanup deprecated EntityBase::hash_base() (#3525)
Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
2022-06-08 09:13:11 +12:00

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