ESPHome
2023.11.6
|
This class represents a requested change in a light state. More...
#include <light_call.h>
Public Member Functions | |
LightCall (LightState *parent) | |
LightCall & | set_state (optional< bool > state) |
Set the binary ON/OFF state of the light. More... | |
LightCall & | set_state (bool state) |
Set the binary ON/OFF state of the light. More... | |
LightCall & | set_transition_length (optional< uint32_t > transition_length) |
Set the transition length of this call in milliseconds. More... | |
LightCall & | set_transition_length (uint32_t transition_length) |
Set the transition length of this call in milliseconds. More... | |
LightCall & | set_transition_length_if_supported (uint32_t transition_length) |
Set the transition length property if the light supports transitions. More... | |
LightCall & | set_flash_length (optional< uint32_t > flash_length) |
Start and set the flash length of this call in milliseconds. More... | |
LightCall & | set_flash_length (uint32_t flash_length) |
Start and set the flash length of this call in milliseconds. More... | |
LightCall & | set_brightness (optional< float > brightness) |
Set the target brightness of the light from 0.0 (fully off) to 1.0 (fully on) More... | |
LightCall & | set_brightness (float brightness) |
Set the target brightness of the light from 0.0 (fully off) to 1.0 (fully on) More... | |
LightCall & | set_brightness_if_supported (float brightness) |
Set the brightness property if the light supports brightness. More... | |
LightCall & | set_color_mode (optional< ColorMode > color_mode) |
Set the color mode of the light. More... | |
LightCall & | set_color_mode (ColorMode color_mode) |
Set the color mode of the light. More... | |
LightCall & | set_color_mode_if_supported (ColorMode color_mode) |
Set the color mode of the light, if this mode is supported. More... | |
LightCall & | set_color_brightness (optional< float > brightness) |
Set the color brightness of the light from 0.0 (no color) to 1.0 (fully on) More... | |
LightCall & | set_color_brightness (float brightness) |
Set the color brightness of the light from 0.0 (no color) to 1.0 (fully on) More... | |
LightCall & | set_color_brightness_if_supported (float brightness) |
Set the color brightness property if the light supports RGBW. More... | |
LightCall & | set_red (optional< float > red) |
Set the red RGB value of the light from 0.0 to 1.0. More... | |
LightCall & | set_red (float red) |
Set the red RGB value of the light from 0.0 to 1.0. More... | |
LightCall & | set_red_if_supported (float red) |
Set the red property if the light supports RGB. More... | |
LightCall & | set_green (optional< float > green) |
Set the green RGB value of the light from 0.0 to 1.0. More... | |
LightCall & | set_green (float green) |
Set the green RGB value of the light from 0.0 to 1.0. More... | |
LightCall & | set_green_if_supported (float green) |
Set the green property if the light supports RGB. More... | |
LightCall & | set_blue (optional< float > blue) |
Set the blue RGB value of the light from 0.0 to 1.0. More... | |
LightCall & | set_blue (float blue) |
Set the blue RGB value of the light from 0.0 to 1.0. More... | |
LightCall & | set_blue_if_supported (float blue) |
Set the blue property if the light supports RGB. More... | |
LightCall & | set_white (optional< float > white) |
Set the white value value of the light from 0.0 to 1.0 for RGBW[W] lights. More... | |
LightCall & | set_white (float white) |
Set the white value value of the light from 0.0 to 1.0 for RGBW[W] lights. More... | |
LightCall & | set_white_if_supported (float white) |
Set the white property if the light supports RGB. More... | |
LightCall & | set_color_temperature (optional< float > color_temperature) |
Set the color temperature of the light in mireds for CWWW or RGBWW lights. More... | |
LightCall & | set_color_temperature (float color_temperature) |
Set the color temperature of the light in mireds for CWWW or RGBWW lights. More... | |
LightCall & | set_color_temperature_if_supported (float color_temperature) |
Set the color_temperature property if the light supports color temperature. More... | |
LightCall & | set_cold_white (optional< float > cold_white) |
Set the cold white value of the light from 0.0 to 1.0. More... | |
LightCall & | set_cold_white (float cold_white) |
Set the cold white value of the light from 0.0 to 1.0. More... | |
LightCall & | set_cold_white_if_supported (float cold_white) |
Set the cold white property if the light supports cold white output. More... | |
LightCall & | set_warm_white (optional< float > warm_white) |
Set the warm white value of the light from 0.0 to 1.0. More... | |
LightCall & | set_warm_white (float warm_white) |
Set the warm white value of the light from 0.0 to 1.0. More... | |
LightCall & | set_warm_white_if_supported (float warm_white) |
Set the warm white property if the light supports cold white output. More... | |
LightCall & | set_effect (optional< std::string > effect) |
Set the effect of the light by its name. More... | |
LightCall & | set_effect (const std::string &effect) |
Set the effect of the light by its name. More... | |
LightCall & | set_effect (uint32_t effect_number) |
Set the effect of the light by its internal index number (only for internal use). More... | |
LightCall & | set_effect (optional< uint32_t > effect_number) |
LightCall & | set_publish (bool publish) |
Set whether this light call should trigger a publish state. More... | |
LightCall & | set_save (bool save) |
Set whether this light call should trigger a save state to recover them at startup.. More... | |
LightCall & | set_rgb (float red, float green, float blue) |
Set the RGB color of the light by RGB values. More... | |
LightCall & | set_rgbw (float red, float green, float blue, float white) |
Set the RGBW color of the light by RGB values. More... | |
LightCall & | from_light_color_values (const LightColorValues &values) |
void | perform () |
Protected Member Functions | |
ColorMode | get_active_color_mode_ () |
Get the currently targeted, or active if none set, color mode. More... | |
LightColorValues | validate_ () |
Validate all properties and return the target light color values. More... | |
ColorMode | compute_color_mode_ () |
std::set< ColorMode > | get_suitable_color_modes_ () |
Get potential color modes for this light call. More... | |
void | transform_parameters_ () |
Some color modes also can be set using non-native parameters, transform those calls. More... | |
bool | has_transition_ () |
bool | has_flash_ () |
bool | has_effect_ () |
Protected Attributes | |
LightState * | parent_ |
optional< bool > | state_ |
optional< uint32_t > | transition_length_ |
optional< uint32_t > | flash_length_ |
optional< ColorMode > | color_mode_ |
optional< float > | brightness_ |
optional< float > | color_brightness_ |
optional< float > | red_ |
optional< float > | green_ |
optional< float > | blue_ |
optional< float > | white_ |
optional< float > | color_temperature_ |
optional< float > | cold_white_ |
optional< float > | warm_white_ |
optional< uint32_t > | effect_ |
bool | publish_ {true} |
bool | save_ {true} |
This class represents a requested change in a light state.
Definition at line 14 of file light_call.h.
|
inlineexplicit |
Definition at line 16 of file light_call.h.
|
protected |
Definition at line 368 of file light_call.cpp.
LightCall & esphome::light::LightCall::from_light_color_values | ( | const LightColorValues & | values | ) |
Definition at line 480 of file light_call.cpp.
|
protected |
Get the currently targeted, or active if none set, color mode.
Definition at line 494 of file light_call.cpp.
|
protected |
Get potential color modes for this light call.
Definition at line 414 of file light_call.cpp.
|
inlineprotected |
Definition at line 175 of file light_call.h.
|
inlineprotected |
Definition at line 174 of file light_call.h.
|
inlineprotected |
Definition at line 173 of file light_call.h.
void esphome::light::LightCall::perform | ( | ) |
Definition at line 31 of file light_call.cpp.
Set the blue RGB value of the light from 0.0 to 1.0.
Note that this only controls the color of the light, not its brightness.
Definition at line 617 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_blue | ( | float | blue | ) |
Set the blue RGB value of the light from 0.0 to 1.0.
Note that this only controls the color of the light, not its brightness.
Definition at line 621 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_blue_if_supported | ( | float | blue | ) |
Set the blue property if the light supports RGB.
Definition at line 527 of file light_call.cpp.
Set the target brightness of the light from 0.0 (fully off) to 1.0 (fully on)
Definition at line 577 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_brightness | ( | float | brightness | ) |
Set the target brightness of the light from 0.0 (fully off) to 1.0 (fully on)
Definition at line 581 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_brightness_if_supported | ( | float | brightness | ) |
Set the brightness property if the light supports brightness.
Definition at line 502 of file light_call.cpp.
Set the cold white value of the light from 0.0 to 1.0.
Definition at line 641 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_cold_white | ( | float | cold_white | ) |
Set the cold white value of the light from 0.0 to 1.0.
Definition at line 645 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_cold_white_if_supported | ( | float | cold_white | ) |
Set the cold white property if the light supports cold white output.
Definition at line 543 of file light_call.cpp.
Set the color brightness of the light from 0.0 (no color) to 1.0 (fully on)
Definition at line 593 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_color_brightness | ( | float | brightness | ) |
Set the color brightness of the light from 0.0 (no color) to 1.0 (fully on)
Definition at line 597 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_color_brightness_if_supported | ( | float | brightness | ) |
Set the color brightness property if the light supports RGBW.
Definition at line 512 of file light_call.cpp.
Set the color mode of the light.
Definition at line 585 of file light_call.cpp.
Set the color mode of the light.
Definition at line 589 of file light_call.cpp.
Set the color mode of the light, if this mode is supported.
Definition at line 507 of file light_call.cpp.
Set the color temperature of the light in mireds for CWWW or RGBWW lights.
Definition at line 633 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_color_temperature | ( | float | color_temperature | ) |
Set the color temperature of the light in mireds for CWWW or RGBWW lights.
Definition at line 637 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_color_temperature_if_supported | ( | float | color_temperature | ) |
Set the color_temperature property if the light supports color temperature.
Definition at line 537 of file light_call.cpp.
Set the effect of the light by its name.
Definition at line 657 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_effect | ( | const std::string & | effect | ) |
Set the effect of the light by its name.
Definition at line 459 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_effect | ( | uint32_t | effect_number | ) |
Set the effect of the light by its internal index number (only for internal use).
Definition at line 662 of file light_call.cpp.
Definition at line 666 of file light_call.cpp.
Start and set the flash length of this call in milliseconds.
Definition at line 569 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_flash_length | ( | uint32_t | flash_length | ) |
Start and set the flash length of this call in milliseconds.
Definition at line 573 of file light_call.cpp.
Set the green RGB value of the light from 0.0 to 1.0.
Note that this only controls the color of the light, not its brightness.
Definition at line 609 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_green | ( | float | green | ) |
Set the green RGB value of the light from 0.0 to 1.0.
Note that this only controls the color of the light, not its brightness.
Definition at line 613 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_green_if_supported | ( | float | green | ) |
Set the green property if the light supports RGB.
Definition at line 522 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_publish | ( | bool | publish | ) |
Set whether this light call should trigger a publish state.
Definition at line 670 of file light_call.cpp.
Set the red RGB value of the light from 0.0 to 1.0.
Note that this only controls the color of the light, not its brightness.
Definition at line 601 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_red | ( | float | red | ) |
Set the red RGB value of the light from 0.0 to 1.0.
Note that this only controls the color of the light, not its brightness.
Definition at line 605 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_red_if_supported | ( | float | red | ) |
Set the red property if the light supports RGB.
Definition at line 517 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_rgb | ( | float | red, |
float | green, | ||
float | blue | ||
) |
Set the RGB color of the light by RGB values.
Please note that this only changes the color of the light, not the brightness.
red | The red color value from 0.0 to 1.0. |
green | The green color value from 0.0 to 1.0. |
blue | The blue color value from 0.0 to 1.0. |
Definition at line 678 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_rgbw | ( | float | red, |
float | green, | ||
float | blue, | ||
float | white | ||
) |
Set the RGBW color of the light by RGB values.
Please note that this only changes the color of the light, not the brightness.
red | The red color value from 0.0 to 1.0. |
green | The green color value from 0.0 to 1.0. |
blue | The blue color value from 0.0 to 1.0. |
white | The white color value from 0.0 to 1.0. |
Definition at line 684 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_save | ( | bool | save | ) |
Set whether this light call should trigger a save state to recover them at startup..
Definition at line 674 of file light_call.cpp.
Set the binary ON/OFF state of the light.
Definition at line 553 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_state | ( | bool | state | ) |
Set the binary ON/OFF state of the light.
Definition at line 557 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_transition_length | ( | optional< uint32_t > | transition_length | ) |
Set the transition length of this call in milliseconds.
This argument is ignored for starting flashes and effects.
Defaults to the default transition length defined in the light configuration.
Definition at line 561 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_transition_length | ( | uint32_t | transition_length | ) |
Set the transition length of this call in milliseconds.
This argument is ignored for starting flashes and effects.
Defaults to the default transition length defined in the light configuration.
Definition at line 565 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_transition_length_if_supported | ( | uint32_t | transition_length | ) |
Set the transition length property if the light supports transitions.
Definition at line 497 of file light_call.cpp.
Set the warm white value of the light from 0.0 to 1.0.
Definition at line 649 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_warm_white | ( | float | warm_white | ) |
Set the warm white value of the light from 0.0 to 1.0.
Definition at line 653 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_warm_white_if_supported | ( | float | warm_white | ) |
Set the warm white property if the light supports cold white output.
Definition at line 548 of file light_call.cpp.
Set the white value value of the light from 0.0 to 1.0 for RGBW[W] lights.
Definition at line 625 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_white | ( | float | white | ) |
Set the white value value of the light from 0.0 to 1.0 for RGBW[W] lights.
Definition at line 629 of file light_call.cpp.
LightCall & esphome::light::LightCall::set_white_if_supported | ( | float | white | ) |
Set the white property if the light supports RGB.
Definition at line 532 of file light_call.cpp.
|
protected |
Some color modes also can be set using non-native parameters, transform those calls.
Definition at line 337 of file light_call.cpp.
|
protected |
Validate all properties and return the target light color values.
Definition at line 133 of file light_call.cpp.
|
protected |
Definition at line 186 of file light_call.h.
|
protected |
Definition at line 182 of file light_call.h.
|
protected |
Definition at line 189 of file light_call.h.
|
protected |
Definition at line 183 of file light_call.h.
Definition at line 181 of file light_call.h.
|
protected |
Definition at line 188 of file light_call.h.
|
protected |
Definition at line 191 of file light_call.h.
|
protected |
Definition at line 180 of file light_call.h.
|
protected |
Definition at line 185 of file light_call.h.
|
protected |
Definition at line 177 of file light_call.h.
|
protected |
Definition at line 192 of file light_call.h.
|
protected |
Definition at line 184 of file light_call.h.
|
protected |
Definition at line 193 of file light_call.h.
|
protected |
Definition at line 178 of file light_call.h.
|
protected |
Definition at line 179 of file light_call.h.
|
protected |
Definition at line 190 of file light_call.h.
|
protected |
Definition at line 187 of file light_call.h.