7static const char *
const TAG =
"light.addressable";
12#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
15 ESP_LOGVV(TAG,
"Addressable Light '%s' (effect_active=%s)", name, YESNO(this->
effect_active_));
16 for (
int i = 0; i < this->
size(); i++) {
17 auto color = this->
get(i);
18 ESP_LOGVV(TAG,
" [%2d] Color: R=%3u G=%3u B=%3u W=%3u", i, color.get_red_raw(), color.get_green_raw(),
19 color.get_blue_raw(), color.get_white_raw());
27 return make_unique<AddressableLightTransformer>(*
this);
31 auto r = to_uint8_scale(
val.get_color_brightness() *
val.get_red());
32 auto g = to_uint8_scale(
val.get_color_brightness() *
val.get_green());
33 auto b = to_uint8_scale(
val.get_color_brightness() *
val.get_blue());
34 auto w = to_uint8_scale(
val.get_white());
35 return Color(r, g, b, w);
40 auto max_brightness = to_uint8_scale(
val.get_brightness() *
val.get_state());
61 this->
target_color_ *= to_uint8_scale(end_values.get_brightness() * end_values.get_state());
65 return uint8_t(int32_t(a) - (((int32_t(a) - int32_t(b)) * scale) / 256));
102 for (
auto led : this->
light_) {
109 this->light_.schedule_show();
virtual void setup()
Where the component's initialization should happen.
void set_interval(const std::string &name, uint32_t interval, std::function< void()> &&f)
Set an interval function with a unique name.
const StringRef & get_name() const
constexpr const char * c_str() const
LightState * state_parent_
ESPColorView get(int32_t index)
virtual int32_t size() const =0
void call_setup() override
bool is_effect_active() const
void update_state(LightState *state) override
std::unique_ptr< LightTransformer > create_default_transition() override
ESPColorCorrection correction_
void set_local_brightness(uint8_t local_brightness)
This class represents the color state for a light object.
static LightColorValues lerp(const LightColorValues &start, const LightColorValues &end, float completion)
Linearly interpolate between the values in start to the values in end.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Color color_from_light_color_values(LightColorValues val)
Convert the color information from a LightColorValues object to a Color object (does not apply bright...
constexpr uint8_t subtract_scaled_difference(uint8_t a, uint8_t b, int32_t scale)
Providing packet encoding functions for exchanging data with a remote host.