18 void play(const Ts &...
x)
override {
20 if (this->oscillating_.has_value()) {
21 call.set_oscillating(this->oscillating_.value(x...));
23 if (this->speed_.has_value()) {
24 call.set_speed(this->speed_.value(x...));
26 if (this->direction_.has_value()) {
27 call.set_direction(this->direction_.value(x...));
59 void play(
const Ts &...
x)
override {
65 bool off_speed_cycle = no_off_cycle_.value(
x...);
66 if (
speed > supported_speed_count && off_speed_cycle) {
72 }
else if (
speed > supported_speed_count && !off_speed_cycle) {
129 auto should_trigger = is_on && !this->
last_on_;
131 if (should_trigger) {
148 auto should_trigger = !is_on && this->
last_on_;
149 this->last_on_ = is_on;
150 if (should_trigger) {
169 if (should_trigger) {
188 if (should_trigger) {
207 if (should_trigger) {
226 if (should_trigger) {
virtual void play(const Ts &...x)=0
Base class for all automation conditions.
StringRef is a reference to a string owned by something else.
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
TEMPLATABLE_VALUE(bool, no_off_cycle) void play(const Ts &...x) override
CycleSpeedAction(Fan *state)
FanCall & set_speed(int speed)
FanDirectionSetTrigger(Fan *state)
FanDirection last_direction_
void add_on_state_callback(F &&callback)
Register a callback that will be called each time the state changes.
virtual FanTraits get_traits()=0
StringRef get_preset_mode() const
Get the current preset mode.
FanDirection direction
The current direction of the fan.
bool oscillating
The current oscillation state of the fan.
bool state
The current on/off state of the fan.
int speed
The current fan speed level.
bool check(const Ts &...x) override
FanIsOffCondition(Fan *state)
bool check(const Ts &...x) override
FanIsOnCondition(Fan *state)
FanOscillatingSetTrigger(Fan *state)
StringRef last_preset_mode_
FanPresetSetTrigger(Fan *state)
FanSpeedSetTrigger(Fan *state)
FanStateTrigger(Fan *state)
int supported_speed_count() const
Return how many speed levels the fan has.
FanTurnOffTrigger(Fan *state)
FanTurnOnTrigger(Fan *state)
void play(const Ts &...x) override
void play(const Ts &...x) override
TurnOffAction(Fan *state)
TEMPLATABLE_VALUE(bool, oscillating) TEMPLATABLE_VALUE(int
FanDirection
Simple enum to represent the direction of a fan.
Providing packet encoding functions for exchanging data with a remote host.