Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
esphome::home_io_control::IOHomeCover Class Reference

Cover entity representing an IO‑Homecontrol shutter/awning/blind. More...

#include <platform_cover.h>

Inheritance diagram for esphome::home_io_control::IOHomeCover:
Collaboration diagram for esphome::home_io_control::IOHomeCover:

Public Member Functions

 IOHomeCover ()=default
void setup () override
 Initialize the cover entity (register device, subscribe to updates, schedule initial status poll).
void dump_config () override
 Dump configuration to log.
float get_setup_priority () const override
 Get setup priority (DATA so we have device registry available).
cover::CoverTraits get_traits () override
 Return the traits object describing this cover's capabilities.
void set_invert_position (bool invert)
 Enable or disable position inversion.
void set_rain_sensor_poll_interval (uint32_t interval_ms)
 Opt this cover into the periodic rain sensor poll (from YAML rain_sensor_poll_interval).
void set_sun_level_poll_interval (uint32_t interval_ms)
 Opt this cover into the periodic sun level poll (from YAML sun_level_poll_interval).
void set_battery_level_poll_interval (uint32_t interval_ms)
 Opt this cover into the periodic battery level poll (from YAML battery_level_poll_interval).
void set_status_refresh_interval (uint32_t interval_ms)
 Opt this cover into the status refresh at rest (from YAML status_refresh_interval).
bool supports_intermediate_positions () const
 Query whether this device takes intermediate positions (a slider) or only open / close / stop.
bool supports_tilt () const
 Query whether this device supports tilt (slat angle) control.
Public Member Functions inherited from esphome::home_io_control::DeviceBoundEntity
void set_parent (IOHomeControlComponent *parent)
 Set the parent controller component.
void set_device_id (const std::string &id)
 Set the unique IO-homecontrol device ID (from YAML).
void set_device_type (DeviceType type)
 Set the declared device type (from YAML).
void set_subtype (uint8_t subtype)
 Set the declared device subtype (from YAML).
void set_device_model (DeviceModel model)
 Set the declared product model below the subtype (YAML io_model:).
void set_optimistic_state (bool optimistic_state)
 Enable or disable optimistic target updates for this device (from YAML).
void set_travel_speed (TravelSpeed speed)
 Set the speed profile of this device's position moves (from YAML travel_speed: or silent:).
void set_low_power (bool low_power)
 Mark this device as a low-power / duty-cycled receiver.
void set_system_key (const std::string &key)
 Give this device a system key of its own (system_key: in YAML).
void set_battery_entities (bool battery_entities)
 Record that the YAML declared battery: true, so the status log line names the battery level even when the device reports none.
void set_status_poll_interval (uint32_t poll_interval_ms)
 Configure bounded follow-up polling while a state change is expected.

Protected Member Functions

void control (const cover::CoverCall &call) override
 Handle cover commands from Home Assistant (open/close/stop/set_position).
void on_device_update_ (const std::string &id, const IoDevice &dev)
 Callback invoked when the underlying device state changes.
bool effective_invert_ () const
 Resolve the current inversion mode.
cover::CoverOperation infer_operation_from_position_delta_ (bool invert, float current_io_position) const
 Infer HA movement direction from successive IO positions when the protocol target is unknown.
Protected Member Functions inherited from esphome::home_io_control::DeviceBoundEntity
void register_device_binding_ (Component *self, DeviceCapabilityClass entity_class, std::optional< bool > invert_override, std::function< void(const std::string &, const IoDevice &)> on_update, bool dimmable=false)
 Perform the shared setup() registration ritual.
DeviceFeatures device_features_ (DeviceCapabilityClass entity_class) const
 What this entity's device can do: the registered device's features, or, before it is registered, the features its declared kind resolves to.
bool passes_binary_update_filter_ (const std::string &id, const IoDevice &dev) const
 Shared inbound-update guard for binary endpoints.
void log_poll_interval_config_ (const char *tag) const
 Emit the shared two-branch poll-interval line for dump_config().

Protected Attributes

bool invert_ {false}
bool invert_explicit_ {false}
float last_io_position_ {UNKNOWN_POSITION}
uint32_t rain_sensor_poll_interval_ms_ {0}
 0 = not opted in; no rain poll is scheduled.
uint32_t sun_level_poll_interval_ms_ {0}
 0 = not opted in; no sun level poll is scheduled.
uint32_t battery_level_poll_interval_ms_ {0}
 0 = not opted in; no battery level poll is scheduled.
uint32_t status_refresh_interval_ms_ {0}
 0 = not opted in; no status refresh is scheduled.
Protected Attributes inherited from esphome::home_io_control::DeviceBoundEntity
IOHomeControlComponent * parent_ {nullptr}
std::string device_id_
DeviceType device_type_ {DeviceType::UNKNOWN}
uint8_t subtype_ {0}
DeviceModel model_ {DeviceModel::NONE}
uint32_t status_poll_interval_ms_ {0}
bool optimistic_state_ {true}
TravelSpeed travel_speed_ {TravelSpeed::FAST}
bool low_power_ {false}
bool battery_entities_ {false}
bool has_system_key_ {false}
uint8_t system_key_ [AES_KEY_SIZE] {}
 Key material: never logged.

Detailed Description

Cover entity representing an IO‑Homecontrol shutter/awning/blind.

The device-binding setters, setup() registration ritual and poll-interval dump line come from DeviceBoundEntity; the richer position/tilt/movement mapping and the invert option stay here.

Definition at line 33 of file platform_cover.h.

Constructor & Destructor Documentation

◆ IOHomeCover()

esphome::home_io_control::IOHomeCover::IOHomeCover ( )
default
Here is the call graph for this function:

Member Function Documentation

◆ control()

void esphome::home_io_control::IOHomeCover::control ( const cover::CoverCall & call)
overrideprotected

Handle cover commands from Home Assistant (open/close/stop/set_position).

Parameters
callCoverCall containing the requested operation.
Todo
Monitor https://github.com/home-assistant/core/issues/174533 — if HA adds a combined cover.set_cover_position_and_tilt action, this branch would be exercised directly from a single CoverCall. The queue coalescing in queue_set_device_position/tilt remains a useful optimization for the two-separate-calls path regardless.

Definition at line 127 of file platform_cover.cpp.

Here is the call graph for this function:

◆ dump_config()

void esphome::home_io_control::IOHomeCover::dump_config ( )
override

Dump configuration to log.

Definition at line 258 of file platform_cover.cpp.

Here is the call graph for this function:

◆ effective_invert_()

bool esphome::home_io_control::IOHomeCover::effective_invert_ ( ) const
nodiscardprotected

Resolve the current inversion mode.

Returns
Explicit YAML override when set, otherwise the runtime device profile.

Definition at line 114 of file platform_cover.cpp.

Here is the call graph for this function:

◆ get_setup_priority()

float esphome::home_io_control::IOHomeCover::get_setup_priority ( ) const
inlinenodiscardoverride

Get setup priority (DATA so we have device registry available).

Returns
setup_priority::DATA.

Definition at line 42 of file platform_cover.h.

◆ get_traits()

cover::CoverTraits esphome::home_io_control::IOHomeCover::get_traits ( )
override

Return the traits object describing this cover's capabilities.

Returns
CoverTraits configured for position (with intermediate positions only), stop, optional tilt, and assumed state for a cover that is only open or closed.

Definition at line 92 of file platform_cover.cpp.

Here is the call graph for this function:

◆ infer_operation_from_position_delta_()

cover::CoverOperation esphome::home_io_control::IOHomeCover::infer_operation_from_position_delta_ ( bool invert,
float current_io_position ) const
nodiscardprotected

Infer HA movement direction from successive IO positions when the protocol target is unknown.

Parameters
invertEffective inversion mode for this device.
current_io_positionLatest reported IO position (0=open, 100=closed).
Returns
OPENING, CLOSING, or IDLE when no direction can be inferred yet.

Definition at line 123 of file platform_cover.cpp.

◆ on_device_update_()

void esphome::home_io_control::IOHomeCover::on_device_update_ ( const std::string & id,
const IoDevice & dev )
protected

Callback invoked when the underlying device state changes.

Parameters
idDevice ID that updated.
devUpdated IoDevice state.

Definition at line 188 of file platform_cover.cpp.

Here is the call graph for this function:

◆ set_battery_level_poll_interval()

void esphome::home_io_control::IOHomeCover::set_battery_level_poll_interval ( uint32_t interval_ms)
inline

Opt this cover into the periodic battery level poll (from YAML battery_level_poll_interval).

Parameters
interval_msPoll interval in milliseconds; 0 = not opted in.

Definition at line 64 of file platform_cover.h.

◆ set_invert_position()

void esphome::home_io_control::IOHomeCover::set_invert_position ( bool invert)
inline

Enable or disable position inversion.

Some devices (e.g., horizontal awnings) report reversed open/close semantics.

Parameters
invertTrue to invert the mapping (HA 1.0 → IO 0, HA 0.0 → IO 100).

Definition at line 52 of file platform_cover.h.

◆ set_rain_sensor_poll_interval()

void esphome::home_io_control::IOHomeCover::set_rain_sensor_poll_interval ( uint32_t interval_ms)
inline

Opt this cover into the periodic rain sensor poll (from YAML rain_sensor_poll_interval).

Parameters
interval_msPoll interval in milliseconds; zero (the default) means no poll.

Definition at line 58 of file platform_cover.h.

◆ set_status_refresh_interval()

void esphome::home_io_control::IOHomeCover::set_status_refresh_interval ( uint32_t interval_ms)
inline

Opt this cover into the status refresh at rest (from YAML status_refresh_interval).

Parameters
interval_msRefresh interval in milliseconds; zero (the default) means no refresh.

Definition at line 67 of file platform_cover.h.

◆ set_sun_level_poll_interval()

void esphome::home_io_control::IOHomeCover::set_sun_level_poll_interval ( uint32_t interval_ms)
inline

Opt this cover into the periodic sun level poll (from YAML sun_level_poll_interval).

Parameters
interval_msPoll interval in milliseconds; 0 = not opted in.

Definition at line 61 of file platform_cover.h.

◆ setup()

void esphome::home_io_control::IOHomeCover::setup ( )
override

Initialize the cover entity (register device, subscribe to updates, schedule initial status poll).

Definition at line 75 of file platform_cover.cpp.

Here is the call graph for this function:

◆ supports_intermediate_positions()

bool esphome::home_io_control::IOHomeCover::supports_intermediate_positions ( ) const
nodiscard

Query whether this device takes intermediate positions (a slider) or only open / close / stop.

Returns
true if the device has device_feature::LEVELS.

Definition at line 106 of file platform_cover.cpp.

Here is the call graph for this function:

◆ supports_tilt()

bool esphome::home_io_control::IOHomeCover::supports_tilt ( ) const
nodiscard

Query whether this device supports tilt (slat angle) control.

Returns
true if the device has device_feature::TILT.

Definition at line 110 of file platform_cover.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ battery_level_poll_interval_ms_

uint32_t esphome::home_io_control::IOHomeCover::battery_level_poll_interval_ms_ {0}
protected

0 = not opted in; no battery level poll is scheduled.

Definition at line 98 of file platform_cover.h.

◆ invert_

bool esphome::home_io_control::IOHomeCover::invert_ {false}
protected

Definition at line 93 of file platform_cover.h.

◆ invert_explicit_

bool esphome::home_io_control::IOHomeCover::invert_explicit_ {false}
protected

Definition at line 94 of file platform_cover.h.

◆ last_io_position_

float esphome::home_io_control::IOHomeCover::last_io_position_ {UNKNOWN_POSITION}
protected

Definition at line 95 of file platform_cover.h.

◆ rain_sensor_poll_interval_ms_

uint32_t esphome::home_io_control::IOHomeCover::rain_sensor_poll_interval_ms_ {0}
protected

0 = not opted in; no rain poll is scheduled.

Definition at line 96 of file platform_cover.h.

◆ status_refresh_interval_ms_

uint32_t esphome::home_io_control::IOHomeCover::status_refresh_interval_ms_ {0}
protected

0 = not opted in; no status refresh is scheduled.

Definition at line 99 of file platform_cover.h.

◆ sun_level_poll_interval_ms_

uint32_t esphome::home_io_control::IOHomeCover::sun_level_poll_interval_ms_ {0}
protected

0 = not opted in; no sun level poll is scheduled.

Definition at line 97 of file platform_cover.h.


The documentation for this class was generated from the following files: