ESPHome  2024.10.2
cwww_light_output.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace cwww {
9 
11  public:
12  void set_cold_white(output::FloatOutput *cold_white) { cold_white_ = cold_white; }
13  void set_warm_white(output::FloatOutput *warm_white) { warm_white_ = warm_white; }
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; }
16  void set_constant_brightness(bool constant_brightness) { constant_brightness_ = constant_brightness; }
18  auto traits = light::LightTraits();
19  traits.set_supported_color_modes({light::ColorMode::COLD_WARM_WHITE});
20  traits.set_min_mireds(this->cold_white_temperature_);
21  traits.set_max_mireds(this->warm_white_temperature_);
22  return traits;
23  }
25  float cwhite, wwhite;
26  state->current_values_as_cwww(&cwhite, &wwhite, this->constant_brightness_);
27  this->cold_white_->set_level(cwhite);
28  this->warm_white_->set_level(wwhite);
29  }
30 
31  protected:
37 };
38 
39 } // namespace cwww
40 } // namespace esphome
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
output::FloatOutput * cold_white_
void set_warm_white(output::FloatOutput *warm_white)
void write_state(light::LightState *state) override
void set_level(float state)
Set the level of this float output, this is called from the front-end.
output::FloatOutput * warm_white_
Brightness of cold and warm white output can be controlled.
void set_cold_white(output::FloatOutput *cold_white)
void set_cold_white_temperature(float cold_white_temperature)
void set_warm_white_temperature(float warm_white_temperature)
void current_values_as_cwww(float *cold_white, float *warm_white, bool constant_brightness=false)
This class is used to represent the capabilities of a light.
Definition: light_traits.h:11
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
light::LightTraits get_traits() override
void set_constant_brightness(bool constant_brightness)
bool state
Definition: fan.h:34