18 void play(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(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) {
124 state->add_on_state_callback([
this,
state]() {
125 auto is_on =
state->state;
126 auto should_trigger = is_on && !this->
last_on_;
128 if (should_trigger) {
142 state->add_on_state_callback([
this,
state]() {
143 auto is_on =
state->state;
144 auto should_trigger = !is_on && this->
last_on_;
145 this->last_on_ = is_on;
146 if (should_trigger) {
160 state->add_on_state_callback([
this,
state]() {
164 if (should_trigger) {
178 state->add_on_state_callback([
this,
state]() {
182 if (should_trigger) {
196 state->add_on_state_callback([
this,
state]() {
200 if (should_trigger) {
214 state->add_on_state_callback([
this,
state]() {
218 if (should_trigger) {
virtual void play(Ts... x)=0
Base class for all automation conditions.
TEMPLATABLE_VALUE(bool, no_off_cycle) void play(Ts... x) override
CycleSpeedAction(Fan *state)
FanCall & set_speed(int speed)
FanDirectionSetTrigger(Fan *state)
FanDirection last_direction_
virtual FanTraits get_traits()=0
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.
FanIsOffCondition(Fan *state)
bool check(Ts... x) override
bool check(Ts... x) override
FanIsOnCondition(Fan *state)
FanOscillatingSetTrigger(Fan *state)
std::string 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(Ts... x) override
void play(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.