12 #define LOG_NUMBER(prefix, type, obj) \ 13 if ((obj) != nullptr) { \ 14 ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \ 15 if (!(obj)->get_icon().empty()) { \ 16 ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \ 18 if (!(obj)->traits.get_unit_of_measurement().empty()) { \ 19 ESP_LOGCONFIG(TAG, "%s Unit of Measurement: '%s'", prefix, (obj)->traits.get_unit_of_measurement().c_str()); \ 21 if (!(obj)->traits.get_device_class().empty()) { \ 22 ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->traits.get_device_class().c_str()); \ 26 #define SUB_NUMBER(name) \ 28 number::Number *name##_number_{nullptr}; \ 31 void set_##name##_number(number::Number *number) { this->name##_number_ = number; } 63 virtual void control(
float value) = 0;
bool has_state() const
Return whether this number has gotten a full state yet.
void add_on_state_callback(std::function< void(float)> &&callback)
void publish_state(float state)
CallbackManager< void(float)> state_callback_
virtual void control(float value)=0
Set the value of the number, this is a virtual method that each number integration must implement...
Base-class for all numbers.
Implementation of SPI Controller mode.