15 #define LOG_COVER(prefix, type, obj) \ 16 if ((obj) != nullptr) { \ 17 ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \ 18 auto traits_ = (obj)->get_traits(); \ 19 if (traits_.get_is_assumed_state()) { \ 20 ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \ 22 if (!(obj)->get_device_class().empty()) { \ 23 ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class().c_str()); \ 132 ESPDEPRECATED(
"open() is deprecated, use make_call().set_command_open().perform() instead.",
"2021.9")
138 ESPDEPRECATED(
"close() is deprecated, use make_call().set_command_close().perform() instead.",
"2021.9")
145 ESPDEPRECATED(
"stop() is deprecated, use make_call().set_command_stop().perform() instead.",
"2021.9")
148 void add_on_state_callback(std::function<
void()> &&f);
157 void publish_state(
bool save =
true);
162 bool is_fully_open()
const;
164 bool is_fully_closed()
const;
169 virtual void control(
const CoverCall &call) = 0;
CoverCall & set_command_open()
Set the command to open the cover.
Base class for all cover devices.
CoverCall & set_command_stop()
Set the command to stop the cover.
CoverOperation
Enum encoding the current operation of a cover.
optional< float > position_
CoverCall & set_command(const char *command)
Set the command as a string, "STOP", "OPEN", "CLOSE", "TOGGLE".
CoverCall & set_position(float position)
Set the call to a certain target position.
The cover is currently closing.
CoverCall to_call(Cover *cover)
Convert this struct to a cover call that can be performed.
void perform()
Perform the cover call.
CoverCall & set_stop(bool stop)
Set whether this cover call should stop the cover.
Struct used to store the restored state of a cover.
ESPDEPRECATED("Use Color::BLACK instead of COLOR_BLACK", "v1.21") extern const Color COLOR_BLACK
void apply(Cover *cover)
Apply these settings to the cover.
CoverCall & set_command_toggle()
Set the command to toggle the cover.
CoverCall & set_command_close()
Set the command to close the cover.
const char * cover_operation_to_str(CoverOperation op)
const optional< bool > & get_toggle() const
The cover is currently idle (not moving)
enum esphome::cover::CoverOperation __attribute__
float position
The position of the cover from 0.0 (fully closed) to 1.0 (fully open).
Implementation of SPI Controller mode.
CoverCall & set_tilt(float tilt)
Set the call to a certain target tilt.
The cover is currently opening.
const optional< float > & get_tilt() const
const optional< float > & get_position() const