ESPHome  2024.9.2
ct_light_output.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace 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_warm_white_temperature(float warm_white_temperature)
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition: light_state.h:34
Interface to write LightStates to hardware.
Definition: light_output.h:12
Base class for all output components that can output a variable level, like PWM.
Definition: float_output.h:31
Color temperature can be controlled.
light::LightTraits get_traits() override
void set_level(float state)
Set the level of this float output, this is called from the front-end.
void write_state(light::LightState *state) override
void current_values_as_ct(float *color_temperature, float *white_brightness)
This class is used to represent the capabilities of a light.
Definition: light_traits.h:11
void set_color_temperature(output::FloatOutput *color_temperature)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_cold_white_temperature(float cold_white_temperature)
void set_brightness(output::FloatOutput *brightness)
bool state
Definition: fan.h:34