12inline static float random_cubic_float() {
23 const uint32_t now =
millis();
66 const uint32_t now =
millis();
83 call.set_color_temperature(min +
random_float() * (max - min));
115 LambdaLightEffect(
const std::string &name, std::function<
void(
bool initial_run)> f, uint32_t update_interval)
115 LambdaLightEffect(
const std::string &name, std::function<
void(
bool initial_run)> f, uint32_t update_interval) {
…}
120 const uint32_t now =
millis();
129 std::function<void(
bool initial_run)>
f_;
160 const uint32_t now =
millis();
171 if (!color.is_on()) {
173 call.set_brightness(0.0f);
174 call.set_state(
true);
199 const float alpha = this->
alpha_;
200 const float beta = 1.0f - alpha;
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(Ts... x)
Inform the parent automation that the event has triggered.
AutomationLightEffect(const std::string &name)
Trigger * get_trig() const
void set_alpha(float alpha)
FlickerLightEffect(const std::string &name)
void set_intensity(float intensity)
uint32_t update_interval_
std::function< void(bool initial_run)> f_
LambdaLightEffect(const std::string &name, std::function< void(bool initial_run)> f, uint32_t update_interval)
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 & set_brightness_if_supported(float brightness)
Set the brightness property if the light supports brightness.
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.
void set_brightness(float brightness)
Set the brightness 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.
float get_green() const
Get the green property of these light color values. In range 0.0 to 1.0.
void set_state(float state)
Set the state of these light color values. In range from 0.0 (off) to 1.0 (on)
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.
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_
void set_transition_on_length(uint32_t transition_length)
PulseLightEffect(const std::string &name)
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_
uint32_t transition_length_
void set_update_interval(uint32_t update_interval)
void set_transition_length(uint32_t transition_length)
RandomLightEffect(const std::string &name)
StrobeLightEffect(const std::string &name)
std::vector< StrobeLightEffectColor > colors_
void set_colors(const std::vector< StrobeLightEffectColor > &colors)
@ 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.
Providing packet encoding functions for exchanging data with a remote host.
float random_float()
Return a random float between 0 and 1.
uint32_t IRAM_ATTR HOT millis()
uint32_t transition_length