13inline static float random_cubic_float() {
30 call.set_brightness_if_supported(
out);
34 call.set_publish(
false);
84 call.set_color_temperature(min +
random_float() * (max - min));
175static_assert(std::is_trivially_copyable_v<StrobeLightEffectColor>,
"StrobeLightEffectColor is copied out of flash");
177 "StrobeLightEffectColor must be whole words for ESP8266 flash reads");
202 if (!color.
is_on()) {
204 call.set_brightness(0.0f);
205 call.set_state(
true);
237 const float alpha = this->
alpha_;
238 const float beta = 1.0f - alpha;
Lightweight read-only view over a const array stored in RODATA (will typically be in flash memory).
void stop_action()
Stop any action connected to this trigger.
bool is_action_running()
Returns true if any action connected to this trigger is running.
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
uint32_t get_current_index() const
Get the current effect index for use in automations.
AutomationLightEffect(const char *name)
FlickerLightEffect(const char *name)
void set_alpha(float alpha)
void set_intensity(float intensity)
uint32_t get_current_index() const
Get the current effect index for use in lambda functions.
uint32_t update_interval_
LambdaLightEffect(const char *name, void(*f)(LightState &, bool initial_run), uint32_t update_interval)
void(* f_)(LightState &, bool initial_run)
LightCall & set_publish(bool publish)
Set whether this light call should trigger a publish state.
LightCall & set_transition_length_if_supported(uint32_t transition_length)
Set the transition length property if the light supports transitions.
LightCall & set_save(bool save)
Set whether this light call should trigger a save state to recover them at startup....
LightCall & from_light_color_values(const LightColorValues &values)
LightCall & set_state(optional< bool > state)
Set the binary ON/OFF state of the light.
This class represents the color state for a light object.
float get_brightness() const
Get the brightness property of these light color values. In range 0.0 to 1.0.
float get_blue() const
Get the blue property of these light color values. In range 0.0 to 1.0.
float get_white() const
Get the white property of these light color values. In range 0.0 to 1.0.
float get_cold_white() const
Get the cold white property of these light color values. In range 0.0 to 1.0.
void set_blue(float blue)
Set the blue property of these light color values. In range 0.0 to 1.0.
void set_cold_white(float cold_white)
Set the cold white property of these light color values. In range 0.0 to 1.0.
void set_warm_white(float warm_white)
Set the warm white property of these light color values. In range 0.0 to 1.0.
bool is_on() const
Get the binary true/false state of these light color values.
float get_green() const
Get the green property of these light color values. In range 0.0 to 1.0.
float get_warm_white() const
Get the warm white property of these light color values. In range 0.0 to 1.0.
ColorMode get_color_mode() const
Get the color mode of these light color values.
void set_white(float white)
Set the white property of these light color values. In range 0.0 to 1.0.
float get_red() const
Get the red property of these light color values. In range 0.0 to 1.0.
void set_green(float green)
Set the green property of these light color values. In range 0.0 to 1.0.
void set_red(float red)
Set the red property of these light color values. In range 0.0 to 1.0.
uint32_t get_index() const
Get the index of this effect in the parent light's effect list.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
LightColorValues remote_values
The remote color values reported to the frontend.
LightCall turn_on()
Make a light state call.
LightColorValues current_values
The current values of the light as outputted to the light.
float get_max_mireds() const
float get_min_mireds() const
void set_min_max_brightness(float min, float max)
void set_update_interval(uint32_t update_interval)
uint32_t last_color_change_
uint32_t update_interval_
void set_transition_off_length(uint32_t transition_length)
uint32_t transition_off_length_
PulseLightEffect(const char *name)
void set_transition_on_length(uint32_t transition_length)
uint32_t transition_on_length_
Random effect. Sets random colors every 10 seconds and slowly transitions between them.
uint32_t last_color_change_
uint32_t update_interval_
RandomLightEffect(const char *name)
uint32_t transition_length_
void set_update_interval(uint32_t update_interval)
void set_transition_length(uint32_t transition_length)
uint32_t duration_(size_t index) const
StrobeLightEffect(const char *name)
void set_colors(const StrobeLightEffectColor *colors, size_t count)
Codegen only: point at the generated flash table of steps, which must outlive the effect.
ConstVector< StrobeLightEffectColor > colors_
std::vector< uint8_t > & out
ColorMode
Color modes are a combination of color capabilities that can be used at the same time.
@ RGB
Color can be controlled using RGB format (includes a brightness control for the color).
@ COLOR_TEMPERATURE
Color temperature can be controlled.
@ COLD_WARM_WHITE
Brightness of cold and warm white output can be controlled.
float random_float()
Return a random float between 0 and 1.
void progmem_memcpy(void *dst, const void *src, size_t len)
uint32_t IRAM_ATTR HOT millis()
One strobe step. Codegen keeps the steps in a flash table, so it is read with progmem_memcpy.
uint32_t transition_length