Files
esphome-dev/esphome/components/number/number_traits.cpp
T
Maurice Makaay d9caab4108 Number enhancement (#3429)
Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-05-10 16:58:56 +12:00

21 lines
483 B
C++

#include "esphome/core/log.h"
#include "number_traits.h"
namespace esphome {
namespace number {
static const char *const TAG = "number";
void NumberTraits::set_unit_of_measurement(const std::string &unit_of_measurement) {
this->unit_of_measurement_ = unit_of_measurement;
}
std::string NumberTraits::get_unit_of_measurement() {
if (this->unit_of_measurement_.has_value())
return *this->unit_of_measurement_;
return "";
}
} // namespace number
} // namespace esphome