9static const char *
const TAG =
"time_based.cover";
14 LOG_COVER(
"",
"Time Based Cover",
this);
15 ESP_LOGCONFIG(TAG,
" Open Duration: %.1fs", this->
open_duration_ / 1e3f);
16 ESP_LOGCONFIG(TAG,
" Close Duration: %.1fs", this->
close_duration_ / 1e3f);
20 if (restore.has_value()) {
55 traits.set_supports_stop(
true);
56 traits.set_supports_position(
true);
57 traits.set_supports_toggle(
true);
62 if (
call.get_stop()) {
81 auto pos = *
call.get_position();
149 const uint32_t now =
millis();
176 const uint32_t now =
millis();
uint32_t IRAM_ATTR HOT get_loop_component_start_time() const
Get the cached time in milliseconds from when the current component started its loop execution.
void stop_action()
Stop any action connected to this trigger.
void trigger(Ts... x)
Inform the parent automation that the event has triggered.
const optional< bool > & get_toggle() const
const optional< float > & get_position() const
CoverOperation current_operation
The current operation of the cover (idle, opening, closing).
optional< CoverRestoreState > restore_state_()
void publish_state(bool save=true)
Publish the current state of the cover.
float position
The position of the cover from 0.0 (fully closed) to 1.0 (fully open).
cover::CoverTraits get_traits() override
float get_setup_priority() const override
void stop_prev_trigger_()
bool has_built_in_endstop_
uint32_t last_recompute_time_
bool is_at_target_() const
void recompute_position_()
uint32_t last_publish_time_
void start_direction_(cover::CoverOperation dir)
void control(const cover::CoverCall &call) override
Trigger * prev_command_trigger_
void dump_config() override
cover::CoverOperation last_operation_
CoverOperation
Enum encoding the current operation of a cover.
@ COVER_OPERATION_OPENING
The cover is currently opening.
@ COVER_OPERATION_CLOSING
The cover is currently closing.
@ COVER_OPERATION_IDLE
The cover is currently idle (not moving)
const float DATA
For components that import data from directly connected sensors like DHT.
Providing packet encoding functions for exchanging data with a remote host.
uint32_t IRAM_ATTR HOT millis()
Application App
Global storage of Application pointer - only one Application can exist.
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)