ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
copy_number.cpp
Go to the documentation of this file.
1#include "copy_number.h"
2#include "esphome/core/log.h"
3
4namespace esphome::copy {
5
6ESPHOME_LOG_TAG(TAG, "copy.number");
7
9 this->source_number_->add_on_state_callback([this](float value) { this->publish_state(value); });
10
11 traits.set_min_value(this->source_number_->traits.get_min_value());
12 traits.set_max_value(this->source_number_->traits.get_max_value());
13 traits.set_step(this->source_number_->traits.get_step());
14
15 if (this->source_number_->has_state())
16 this->publish_state(this->source_number_->state);
17}
18
19void CopyNumber::dump_config() { LOG_NUMBER("", "Copy Number", this); }
20
22 auto call2 = this->source_number_->make_call();
23 call2.set_value(value);
24 call2.perform();
25}
26
27} // namespace esphome::copy
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
void control(float value) override
void publish_state(float state)
Definition number.cpp:20
NumberTraits traits
Definition number.h:41
void set_min_value(float min_value)
void set_max_value(float max_value)
ESPHOME_LOG_TAG(TAG, "copy.binary_sensor")
uint32_t value
Definition hal.cpp:41