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

Functions

void clear_status_poll_tracking (IoDevice &dev)
 Clear all bounded follow-up polling state for a device.
bool status_poll_tracking_active (const IoDevice &dev, uint32_t now)
 Check whether a device remains inside its bounded follow-up polling window.
bool is_binary_entity_position (uint8_t position)
 Is the given position value an on/off binary encoding?
bool known_device_matches_entity_class (const IoDevice &dev, DeviceCapabilityClass expected)
 Does the device's type match the expected HA entity class?
bool known_device_supports_status_requests (const IoDevice &dev)
 Does the device support status requests?
bool known_device_accepts_execute_position (const IoDevice &dev, uint8_t position)
 Can this device accept an execute (position) command?
bool known_device_accepts_execute_tilt (const IoDevice &dev)
 Can this device accept a tilt command?
uint32_t status_poll_retry_delay_ms (uint8_t consecutive_failures, bool auth_like_failure)
 Compute the next background status-poll retry delay after a failed exchange.
void log_rejected_operation (const std::string &device_id, const IoDevice &dev, const char *operation, const char *expected)
 Log a rejected operation with capability mismatch details.
void log_component_capture (const RadioDriver *radio, const char *stage, const uint8_t *buf, uint8_t len, const IoFrame *frame=nullptr)
 Log a frame at the "io_capture" tag with structured fields.
void log_frame_issue (IOHomeControlComponent *component, const char *direction, const char *reason, const IoFrame &frame, uint8_t len)
 Log a frame‑level issue (unregistered endpoints, unsupported commands).
void normalize_stopped_state (IoDevice &dev)
 Normalize stopped state: some devices briefly report stopped before target/current converge.
void log_status_update (const std::string &id, const IoDevice &dev, const char *suffix="")
 Log a concise status‑update line used by inbound handlers.

Variables

constexpr const char * TAG = "home_io_control"
 Shared log tag for hub-level messages.
constexpr uint32_t STATUS_RETRY_AFTER_FAIL_MS = 5000
 First retry after a silent status-poll failure.
constexpr uint32_t STATUS_RETRY_AFTER_FAIL_STEP2_MS
 Second retry after a silent status-poll failure.
constexpr uint32_t STATUS_RETRY_AFTER_FAIL_STEP3_MS
 Third retry after a silent status-poll failure.
constexpr uint32_t STATUS_RETRY_AFTER_FAIL_STEP4_MS
 Fourth retry after a silent status-poll failure.
constexpr uint32_t STATUS_RETRY_AFTER_FAIL_MAX_MS
 Steady-state backoff for repeated silent status-poll failures.
constexpr uint32_t STATUS_AUTH_RETRY_AFTER_FAIL_MS
 First retry after a challenge-seen auth-like failure.
constexpr uint32_t STATUS_AUTH_RETRY_AFTER_FAIL_STEP2_MS
 Second retry after a challenge-seen auth-like failure.
constexpr uint32_t STATUS_AUTH_RETRY_AFTER_FAIL_MAX_MS
 Steady-state backoff after repeated auth-like failures.
constexpr uint32_t INITIAL_STATUS_REQUEST_DELAY_MS
 Delay before the first post-boot status request from an entity.
constexpr uint32_t REMOTE_ACTIVITY_STATUS_POLL_DELAY_MS
 Delay before polling after overheard remote traffic.
constexpr uint32_t MAX_TRACKED_STATUS_POLL_WINDOW_MS
 Hard stop for follow-up polling after a command or remote activity.
constexpr uint32_t PAIRING_DISCOVERY_RESPONSE_TIMEOUT_MS = 2000
 Discovery wait window after sending 0x28.
constexpr uint32_t PAIRING_KEY_CHALLENGE_TIMEOUT_MS = 500
 Wait window for the device's 0x3C challenge.
constexpr float BINARY_ENTITY_ON_POSITION_THRESHOLD
 Shared 0-100 cutoff: values below this mean binary "on".
constexpr uint8_t BINARY_ENTITY_ON_POSITION = 0
constexpr uint8_t BINARY_ENTITY_OFF_POSITION = 100

Function Documentation

◆ clear_status_poll_tracking()

void esphome::home_io_control::detail::clear_status_poll_tracking ( IoDevice & dev)
inline

Clear all bounded follow-up polling state for a device.

Parameters
devDevice record to reset.

Definition at line 58 of file hub_internal.h.

◆ is_binary_entity_position()

bool esphome::home_io_control::detail::is_binary_entity_position ( uint8_t position)
inline

Is the given position value an on/off binary encoding?

Parameters
positionPosition value to test.
Returns
true if position equals BINARY_ENTITY_ON_POSITION or BINARY_ENTITY_OFF_POSITION.

Definition at line 81 of file hub_internal.h.

◆ known_device_accepts_execute_position()

bool esphome::home_io_control::detail::known_device_accepts_execute_position ( const IoDevice & dev,
uint8_t position )
inline

Can this device accept an execute (position) command?

Checks capability and, for unknown types, allows binary positions for light/switch.

Parameters
devIoDevice to check.
positionPosition value being sent.
Returns
true if operation is appropriate for this device type.

Definition at line 107 of file hub_internal.h.

Here is the call graph for this function:

◆ known_device_accepts_execute_tilt()

bool esphome::home_io_control::detail::known_device_accepts_execute_tilt ( const IoDevice & dev)
inline

Can this device accept a tilt command?

Parameters
devIoDevice to check.
Returns
true only if device type is known to support tilt.

Definition at line 118 of file hub_internal.h.

Here is the call graph for this function:

◆ known_device_matches_entity_class()

bool esphome::home_io_control::detail::known_device_matches_entity_class ( const IoDevice & dev,
DeviceCapabilityClass expected )
inline

Does the device's type match the expected HA entity class?

UNKNOWN devices always match to keep imported/discovered devices working.

Parameters
devIoDevice to check.
expectedDesired capability class (COVER, LIGHT, SWITCH, etc.).
Returns
true if device type matches or is UNKNOWN.

Definition at line 90 of file hub_internal.h.

Here is the call graph for this function:

◆ known_device_supports_status_requests()

bool esphome::home_io_control::detail::known_device_supports_status_requests ( const IoDevice & dev)
inline

Does the device support status requests?

UNKNOWN devices pass through.

Parameters
devIoDevice to check.
Returns
true if device type supports status requests or is UNKNOWN.

Definition at line 98 of file hub_internal.h.

Here is the call graph for this function:

◆ log_component_capture()

void esphome::home_io_control::detail::log_component_capture ( const RadioDriver * radio,
const char * stage,
const uint8_t * buf,
uint8_t len,
const IoFrame * frame = nullptr )
inline

Log a frame at the "io_capture" tag with structured fields.

Used for protocol‑level debugging (phases: component, tx, rx, parse_ok/parse_fail).

Parameters
radioRadio driver instance (provides chip name and capture).
stageString label for the current phase.
bufRaw bytes being logged.
lenLength of buf.
frameOptional parsed IoFrame for decoded fields (cmd, src, dst).

Definition at line 175 of file hub_internal.h.

Here is the call graph for this function:

◆ log_frame_issue()

void esphome::home_io_control::detail::log_frame_issue ( IOHomeControlComponent * component,
const char * direction,
const char * reason,
const IoFrame & frame,
uint8_t len )
inline

Log a frame‑level issue (unregistered endpoints, unsupported commands).

Parameters
componentPointer to the component (for device lookup).
direction"tx" or "rx".
reasonShort issue label (e.g., "unregistered_device").
frameParsed frame.
lenSerialized length.

Definition at line 198 of file hub_internal.h.

Here is the call graph for this function:

◆ log_rejected_operation()

void esphome::home_io_control::detail::log_rejected_operation ( const std::string & device_id,
const IoDevice & dev,
const char * operation,
const char * expected )
inline

Log a rejected operation with capability mismatch details.

Parameters
device_idDevice ID string.
devIoDevice that rejected the command.
operationHuman‑readable operation name (e.g., "set position").
expectedExpected capability class or profile name.

Definition at line 161 of file hub_internal.h.

Here is the call graph for this function:

◆ log_status_update()

void esphome::home_io_control::detail::log_status_update ( const std::string & id,
const IoDevice & dev,
const char * suffix = "" )
inline

Log a concise status‑update line used by inbound handlers.

Parameters
idDevice ID.
devCurrent device state.
suffixOptional suffix added after the state string (e.g., " (status update)").

Definition at line 235 of file hub_internal.h.

Here is the call graph for this function:

◆ normalize_stopped_state()

void esphome::home_io_control::detail::normalize_stopped_state ( IoDevice & dev)
inline

Normalize stopped state: some devices briefly report stopped before target/current converge.

Parameters
devDevice record to update (may clear is_stopped if positions differ).

Definition at line 222 of file hub_internal.h.

Here is the call graph for this function:

◆ status_poll_retry_delay_ms()

uint32_t esphome::home_io_control::detail::status_poll_retry_delay_ms ( uint8_t consecutive_failures,
bool auth_like_failure )
inline

Compute the next background status-poll retry delay after a failed exchange.

Plain silence is treated as a soft reachability problem and ramps up gradually so sleeping or temporarily busy devices are retried soon. Exchanges that reached the 0x3C challenge but never completed are much more likely to represent an invalid system key or pairing mismatch, so they back off more aggressively to avoid repeated 0x3D HMAC traffic.

Parameters
consecutive_failures1-based count of consecutive failures in the current failure class.
auth_like_failureTrue when the failed exchange saw a 0x3C challenge.
Returns
Delay in milliseconds before the next automatic status poll.

Definition at line 132 of file hub_internal.h.

◆ status_poll_tracking_active()

bool esphome::home_io_control::detail::status_poll_tracking_active ( const IoDevice & dev,
uint32_t now )
inline

Check whether a device remains inside its bounded follow-up polling window.

Parameters
devDevice record.
nowCurrent millis() timestamp.
Returns
true when repeated polling may continue.

Definition at line 70 of file hub_internal.h.

Variable Documentation

◆ BINARY_ENTITY_OFF_POSITION

uint8_t esphome::home_io_control::detail::BINARY_ENTITY_OFF_POSITION = 100
inlineconstexpr

Definition at line 54 of file hub_internal.h.

◆ BINARY_ENTITY_ON_POSITION

uint8_t esphome::home_io_control::detail::BINARY_ENTITY_ON_POSITION = 0
inlineconstexpr

Definition at line 53 of file hub_internal.h.

◆ BINARY_ENTITY_ON_POSITION_THRESHOLD

float esphome::home_io_control::detail::BINARY_ENTITY_ON_POSITION_THRESHOLD
inlineconstexpr
Initial value:
=
50.0F

Shared 0-100 cutoff: values below this mean binary "on".

Definition at line 49 of file hub_internal.h.

◆ INITIAL_STATUS_REQUEST_DELAY_MS

uint32_t esphome::home_io_control::detail::INITIAL_STATUS_REQUEST_DELAY_MS
inlineconstexpr
Initial value:
=
5000

Delay before the first post-boot status request from an entity.

Definition at line 41 of file hub_internal.h.

◆ MAX_TRACKED_STATUS_POLL_WINDOW_MS

uint32_t esphome::home_io_control::detail::MAX_TRACKED_STATUS_POLL_WINDOW_MS
inlineconstexpr
Initial value:
=
600000

Hard stop for follow-up polling after a command or remote activity.

Definition at line 45 of file hub_internal.h.

◆ PAIRING_DISCOVERY_RESPONSE_TIMEOUT_MS

uint32_t esphome::home_io_control::detail::PAIRING_DISCOVERY_RESPONSE_TIMEOUT_MS = 2000
inlineconstexpr

Discovery wait window after sending 0x28.

Definition at line 47 of file hub_internal.h.

◆ PAIRING_KEY_CHALLENGE_TIMEOUT_MS

uint32_t esphome::home_io_control::detail::PAIRING_KEY_CHALLENGE_TIMEOUT_MS = 500
inlineconstexpr

Wait window for the device's 0x3C challenge.

Definition at line 48 of file hub_internal.h.

◆ REMOTE_ACTIVITY_STATUS_POLL_DELAY_MS

uint32_t esphome::home_io_control::detail::REMOTE_ACTIVITY_STATUS_POLL_DELAY_MS
inlineconstexpr
Initial value:
=
2000

Delay before polling after overheard remote traffic.

Definition at line 43 of file hub_internal.h.

◆ STATUS_AUTH_RETRY_AFTER_FAIL_MAX_MS

uint32_t esphome::home_io_control::detail::STATUS_AUTH_RETRY_AFTER_FAIL_MAX_MS
inlineconstexpr
Initial value:
=
300000

Steady-state backoff after repeated auth-like failures.

Definition at line 39 of file hub_internal.h.

◆ STATUS_AUTH_RETRY_AFTER_FAIL_MS

uint32_t esphome::home_io_control::detail::STATUS_AUTH_RETRY_AFTER_FAIL_MS
inlineconstexpr
Initial value:
=
30000

First retry after a challenge-seen auth-like failure.

Definition at line 35 of file hub_internal.h.

◆ STATUS_AUTH_RETRY_AFTER_FAIL_STEP2_MS

uint32_t esphome::home_io_control::detail::STATUS_AUTH_RETRY_AFTER_FAIL_STEP2_MS
inlineconstexpr
Initial value:
=
120000

Second retry after a challenge-seen auth-like failure.

Definition at line 37 of file hub_internal.h.

◆ STATUS_RETRY_AFTER_FAIL_MAX_MS

uint32_t esphome::home_io_control::detail::STATUS_RETRY_AFTER_FAIL_MAX_MS
inlineconstexpr
Initial value:
=
300000

Steady-state backoff for repeated silent status-poll failures.

Definition at line 33 of file hub_internal.h.

◆ STATUS_RETRY_AFTER_FAIL_MS

uint32_t esphome::home_io_control::detail::STATUS_RETRY_AFTER_FAIL_MS = 5000
inlineconstexpr

First retry after a silent status-poll failure.

Definition at line 26 of file hub_internal.h.

◆ STATUS_RETRY_AFTER_FAIL_STEP2_MS

uint32_t esphome::home_io_control::detail::STATUS_RETRY_AFTER_FAIL_STEP2_MS
inlineconstexpr
Initial value:
=
15000

Second retry after a silent status-poll failure.

Definition at line 27 of file hub_internal.h.

◆ STATUS_RETRY_AFTER_FAIL_STEP3_MS

uint32_t esphome::home_io_control::detail::STATUS_RETRY_AFTER_FAIL_STEP3_MS
inlineconstexpr
Initial value:
=
30000

Third retry after a silent status-poll failure.

Definition at line 29 of file hub_internal.h.

◆ STATUS_RETRY_AFTER_FAIL_STEP4_MS

uint32_t esphome::home_io_control::detail::STATUS_RETRY_AFTER_FAIL_STEP4_MS
inlineconstexpr
Initial value:
=
60000

Fourth retry after a silent status-poll failure.

Definition at line 31 of file hub_internal.h.

◆ TAG

const char* esphome::home_io_control::detail::TAG = "home_io_control"
inlineconstexpr

Shared log tag for hub-level messages.

Definition at line 25 of file hub_internal.h.