mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
[fan] Inline the trivial Fan call helpers
This commit is contained in:
@@ -153,11 +153,6 @@ void FanRestoreState::apply(Fan &fan) {
|
||||
fan.publish_state();
|
||||
}
|
||||
|
||||
FanCall Fan::turn_on() { return this->make_call().set_state(true); }
|
||||
FanCall Fan::turn_off() { return this->make_call().set_state(false); }
|
||||
FanCall Fan::toggle() { return this->make_call().set_state(!this->state); }
|
||||
FanCall Fan::make_call() { return FanCall(*this); }
|
||||
|
||||
const char *Fan::find_preset_mode_(const char *preset_mode) {
|
||||
return this->find_preset_mode_(preset_mode, preset_mode ? strlen(preset_mode) : 0);
|
||||
}
|
||||
|
||||
@@ -115,10 +115,10 @@ class Fan : public EntityBase {
|
||||
/// The current direction of the fan
|
||||
FanDirection direction{FanDirection::FORWARD};
|
||||
|
||||
FanCall turn_on();
|
||||
FanCall turn_off();
|
||||
FanCall toggle();
|
||||
FanCall make_call();
|
||||
FanCall turn_on() { return this->make_call().set_state(true); }
|
||||
FanCall turn_off() { return this->make_call().set_state(false); }
|
||||
FanCall toggle() { return this->make_call().set_state(!this->state); }
|
||||
FanCall make_call() { return FanCall(*this); }
|
||||
|
||||
/// Register a callback that will be called each time the state changes.
|
||||
template<typename F> void add_on_state_callback(F &&callback) {
|
||||
|
||||
Reference in New Issue
Block a user