19 void play(
const Ts &...
x)
override {
21 if constexpr (HasTransitionLength) {
51 void play(
const Ts &...
x)
override {
68 template<
typename V>
void set_transition_length(V value)
requires(HasTransitionLength) {
72 void play(
const Ts &...
x)
override {
74 float rel = this->relative_brightness_.value(
x...);
81 call.set_state(new_brightness != 0.0f);
82 call.set_brightness(new_brightness);
84 if constexpr (HasTransitionLength) {
135 auto should_trigger = is_on && !this->
last_on_;
139 if (should_trigger) {
190 void play(const Ts &...
x)
override {
192 int32_t range_from =
interpret_index(this->range_from_.value_or(
x..., 0), out->size());
193 if (range_from < 0 || range_from >= out->size())
196 int32_t range_to =
interpret_index(this->range_to_.value_or(
x..., out->size() - 1) + 1, out->size());
197 if (range_to < 0 || range_to >= out->size())
198 range_to = out->size();
200 uint8_t color_brightness =
201 to_uint8_scale(this->color_brightness_.value_or(
x..., this->parent_->remote_values.get_color_brightness()));
202 auto range = out->range(range_from, range_to);
203 if (this->red_.has_value())
205 if (this->green_.has_value())
207 if (this->blue_.has_value())
209 if (this->white_.has_value())
211 out->schedule_show();
221 return static_cast<uint8_t
>(value);
223 return to_uint8_scale(value);
virtual void play(const Ts &...x)=0
Base class for all automation conditions.
Function-pointer-only templatable storage (4 bytes on 32-bit).
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
static uint8_t to_uint8_compat(float value, const char *field)
AddressableSet(LightState *parent)
TEMPLATABLE_VALUE(int32_t, range_from) TEMPLATABLE_VALUE(int32_t
void play(const Ts &...x) override
TEMPLATABLE_VALUE(float, relative_brightness) template< typename V > void set_transition_length(V value)
void set_limit_mode(LimitMode limit_mode)
std::conditional_t< HasTransitionLength, TemplatableFn< uint32_t, Ts... >, NoTransition > transition_length_
DimRelativeAction(LightState *parent)
void set_min_max_brightness(float min, float max)
This class represents a requested change in a light state.
bool is_on() const
Get the binary true/false state of these light color values.
void as_brightness(float *brightness) const
Convert these light color values to a brightness-only representation and write them to brightness.
LightControlAction(LightState *parent, ApplyFn apply)
void(*)(LightState *, LightCall &, const std::remove_cvref_t< Ts > &...) ApplyFn
void play(const Ts &...x) override
bool check(const Ts &...x) override
LightIsOffCondition(LightState *state)
LightIsOnCondition(LightState *state)
bool check(const Ts &...x) override
Listener interface for light remote value changes.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
void add_remote_values_listener(LightRemoteValuesListener *listener)
Add a listener for remote values changes.
LightColorValues remote_values
The remote color values reported to the frontend.
LightOutput * get_output() const
Get the light output associated with this object.
void add_target_state_reached_listener(LightTargetStateReachedListener *listener)
Add a listener for target state reached.
LightColorValues current_values
The current values of the light as outputted to the light.
void on_light_remote_values_update() override
LightStateTrigger(LightState *a_light)
Listener interface for light target state reached.
void on_light_target_state_reached() override
LightTurnOffTrigger(LightState *a_light)
LightTurnOnTrigger(LightState *a_light)
void on_light_remote_values_update() override
std::conditional_t< HasTransitionLength, TemplatableFn< uint32_t, Ts... >, NoTransition > transition_length_
void play(const Ts &...x) override
void set_transition_length(V value)
ToggleAction(LightState *state)
void apply(Climate *climate)
Apply these settings to the climate device.
void addressableset_warn_about_scale(const char *field)
int32_t HOT interpret_index(int32_t index, int32_t size)