Supported Covers

Example Usage

See Application::register_cover().

API Reference


class cover::Cover

Inherits from Nameable

Subclassed by cover::TemplateCover

Public Functions

cover::CoverCover(const std::string &name)
virtual void cover::Coveropen() = 0
virtual void cover::Coverclose() = 0
virtual void cover::Coverstop() = 0
void cover::Coveradd_on_publish_state_callback(std::function<void(CoverState)> &&f)
void cover::Coverpublish_state(CoverState state)
template <typename T>
OpenAction<T> *cover::Covermake_open_action()
template <typename T>
CloseAction<T> *cover::Covermake_close_action()
template <typename T>
StopAction<T> *cover::Covermake_stop_action()
bool cover::Coveroptimistic()

Return whether this cover is optimistic - i.e.

if both the OPEN/CLOSE actions should be displayed in Home Assistant because the real state is unknown.

Defaults to false.

Public Members

CoverState cover::Coverstate = {COVER_MAX}

Protected Attributes

CallbackManager<void(CoverState)> cover::Coverstate_callback_ = {}
enum cover::CoverState


coverCOVER_OPEN = 0
template <typename T>
class cover::OpenAction

Inherits from Action< T >

Public Functions

cover::OpenActionOpenAction(Cover *cover)
void cover::OpenActionplay(T x)

Protected Attributes

Cover *cover::OpenActioncover_
template <typename T>
class cover::CloseAction

Inherits from Action< T >

Public Functions

cover::CloseActionCloseAction(Cover *cover)
void cover::CloseActionplay(T x)

Protected Attributes

Cover *cover::CloseActioncover_
template <typename T>
class cover::StopAction

Inherits from Action< T >

Public Functions

cover::StopActionStopAction(Cover *cover)
void cover::StopActionplay(T x)

Protected Attributes

Cover *cover::StopActioncover_


class cover::MQTTCoverComponent

Inherits from mqtt::MQTTComponent

Public Functions

cover::MQTTCoverComponentMQTTCoverComponent(Cover *cover)
void cover::MQTTCoverComponentsetup()

Where the component’s initialization should happen.

Analogous to Arduino’s setup(). This method is guaranteed to only be called once. Defaults to doing noting.

void cover::MQTTCoverComponentsend_discovery(JsonBuffer &buffer, JsonObject &root, mqtt::SendDiscoveryConfig &config)

Send discovery info the Home Assistant, override this.

void cover::MQTTCoverComponentsend_initial_state()
bool cover::MQTTCoverComponentis_internal()
void cover::MQTTCoverComponentpublish_state(cover::CoverState state)

Protected Functions

std::string cover::MQTTCoverComponentcomponent_type() const

Override this method to return the component type (e.g. “light”, “sensor”, …)

std::string cover::MQTTCoverComponentfriendly_name() const

Get the friendly name of this MQTT component.

Protected Attributes

Cover *cover::MQTTCoverComponentcover_