17 if (restore.has_value())
23 if (restore.has_value()) {
24 restore->to_call(
this).perform();
37 auto pos = clamp(*s, 0.0f, 1.0f);
45 if (
tilt.has_value()) {
46 auto tilt_val = clamp(*
tilt, 0.0f, 1.0f);
47 if (tilt_val != this->
tilt) {
48 this->
tilt = tilt_val;
64 if (
call.get_stop()) {
81 auto pos_val =
call.get_position();
82 if (pos_val.has_value()) {
86 if (
pos == COVER_OPEN) {
89 }
else if (
pos == COVER_CLOSED) {
101 auto tilt_val =
call.get_tilt();
102 if (tilt_val.has_value()) {
103 auto tilt = *tilt_val;
117 traits.set_supports_stop(this->
has_stop_);
120 traits.set_supports_tilt(this->
has_tilt_);
void disable_loop()
Disable this component's loop.
bool has_value() const
Check if a lambda is set.
void stop_action()
Stop any action connected to this trigger.
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
const optional< bool > & get_toggle() const
bool get_stop_tilt() const
optional< CoverRestoreState > restore_state_()
void publish_state(bool save=true)
Publish the current state of the cover.
float tilt
The current tilt value of the cover from 0.0 to 1.0.
float position
The position of the cover from 0.0 (fully closed) to 1.0 (fully open).
TemplateLambda< float > state_f_
Trigger * get_open_trigger()
Trigger< float > position_trigger_
Trigger * get_close_trigger()
void control(const cover::CoverCall &call) override
Trigger< float > tilt_trigger_
Trigger stop_tilt_trigger_
Trigger * prev_command_trigger_
void stop_prev_trigger_()
void dump_config() override
Trigger< float > * get_position_trigger()
Trigger * get_stop_trigger()
float get_setup_priority() const override
cover::CoverTraits get_traits() override
Trigger * get_stop_tilt_trigger()
Trigger< float > * get_tilt_trigger()
TemplateCoverRestoreMode restore_mode_
Trigger * get_toggle_trigger()
TemplateLambda< float > tilt_f_
ESPHOME_LOG_TAG(TAG, "alarm_control_panel")
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.