57 void play(const Ts &...
x)
override {
59 if (this->stop_.has_value())
61 if (this->position_.has_value())
63 if (this->tilt_.has_value())
79 void play(const Ts &...
x)
override {
80 if (this->position_.has_value())
81 this->cover_->position = this->position_.value(
x...);
82 if (this->tilt_.has_value())
83 this->cover_->tilt = this->tilt_.value(
x...);
84 if (this->current_operation_.has_value())
85 this->cover_->current_operation = this->current_operation_.value(
x...);
86 this->cover_->publish_state();
97 bool check(
const Ts &...
x)
override {
return this->
cover_->
position == (OPEN ? COVER_OPEN : COVER_CLOSED); }
110 if (a_cover->
position != this->last_position_) {
112 if (a_cover->
position == (OPEN ? COVER_OPEN : COVER_CLOSED))
130 if (current_op == OP) {
virtual void play(const Ts &...x)=0
Base class for all automation conditions.
void trigger(const Ts &...x)
void play(const Ts &...x) override
CloseAction(Cover *cover)
ControlAction(Cover *cover)
TEMPLATABLE_VALUE(bool, stop) TEMPLATABLE_VALUE(float
CoverCall & set_command_toggle()
Set the command to toggle the cover.
CoverCall & set_command_open()
Set the command to open the cover.
CoverCall & set_command_close()
Set the command to close the cover.
void perform()
Perform the cover call.
CoverCall & set_position(float position)
Set the call to a certain target position.
CoverCall & set_command_stop()
Set the command to stop the cover.
CoverCall & set_tilt(float tilt)
Set the call to a certain target tilt.
CoverCall & set_stop(bool stop)
Set whether this cover call should stop the cover.
Base class for all cover devices.
CoverOperation current_operation
The current operation of the cover (idle, opening, closing).
void add_on_state_callback(std::function< void()> &&f)
CoverCall make_call()
Construct a new cover call used to control the cover.
float position
The position of the cover from 0.0 (fully closed) to 1.0 (fully open).
bool check(const Ts &...x) override
CoverPositionCondition(Cover *cover)
CoverPositionTrigger(Cover *a_cover)
TEMPLATABLE_VALUE(float, position) TEMPLATABLE_VALUE(float
CoverPublishAction(Cover *cover)
optional< CoverOperation > last_operation_
CoverTrigger(Cover *a_cover)
void play(const Ts &...x) override
void play(const Ts &...x) override
void play(const Ts &...x) override
ToggleAction(Cover *cover)
CoverOperation
Enum encoding the current operation of a cover.