ESPHome 2025.5.0
Loading...
Searching...
No Matches
rgb_light_output.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome {
8namespace rgb {
9
11 public:
12 void set_red(output::FloatOutput *red) { red_ = red; }
13 void set_green(output::FloatOutput *green) { green_ = green; }
14 void set_blue(output::FloatOutput *blue) { blue_ = blue; }
15
17 auto traits = light::LightTraits();
18 traits.set_supported_color_modes({light::ColorMode::RGB});
19 return traits;
20 }
22 float red, green, blue;
23 state->current_values_as_rgb(&red, &green, &blue, false);
24 this->red_->set_level(red);
25 this->green_->set_level(green);
26 this->blue_->set_level(blue);
27 }
28
29 protected:
33};
34
35} // namespace rgb
36} // namespace esphome
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.
light::LightTraits get_traits() override
output::FloatOutput * blue_
void set_green(output::FloatOutput *green)
output::FloatOutput * green_
void set_blue(output::FloatOutput *blue)
output::FloatOutput * red_
void write_state(light::LightState *state) override
void set_red(output::FloatOutput *red)
bool state
Definition fan.h:0
@ RGB
RGB color output.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7