ESPHome 2025.5.0
Loading...
Searching...
No Matches
ct_light_output.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome {
8namespace color_temperature {
9
11 public:
12 void set_color_temperature(output::FloatOutput *color_temperature) { color_temperature_ = color_temperature; }
13 void set_brightness(output::FloatOutput *brightness) { brightness_ = brightness; }
14 void set_cold_white_temperature(float cold_white_temperature) { cold_white_temperature_ = cold_white_temperature; }
15 void set_warm_white_temperature(float warm_white_temperature) { warm_white_temperature_ = warm_white_temperature; }
17 auto traits = light::LightTraits();
18 traits.set_supported_color_modes({light::ColorMode::COLOR_TEMPERATURE});
19 traits.set_min_mireds(this->cold_white_temperature_);
20 traits.set_max_mireds(this->warm_white_temperature_);
21 return traits;
22 }
24 float color_temperature, brightness;
25 state->current_values_as_ct(&color_temperature, &brightness);
26 this->color_temperature_->set_level(color_temperature);
27 this->brightness_->set_level(brightness);
28 }
29
30 protected:
35};
36
37} // namespace color_temperature
38} // namespace esphome
void set_cold_white_temperature(float cold_white_temperature)
void set_color_temperature(output::FloatOutput *color_temperature)
light::LightTraits get_traits() override
void write_state(light::LightState *state) override
void set_warm_white_temperature(float warm_white_temperature)
void set_brightness(output::FloatOutput *brightness)
Interface to write LightStates to hardware.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:63
This class is used to represent the capabilities of a light.
Base class for all output components that can output a variable level, like PWM.
void set_level(float state)
Set the level of this float output, this is called from the front-end.
bool state
Definition fan.h:0
@ COLOR_TEMPERATURE
Controllable color temperature output.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7