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

Functions

 _companion_sensor_name (config, suffix)
 companion_id_base (config, parent_id_key)
 inject_companion_sensor_ids (config, parent_id_key)
 platform_schema_extension ()
 wire_device_binding (var, parent, config)
 _create_companion_text_sensor (config, parent, sensor_id, name, disabled_by_default)
 _create_link_health_sensor (config, parent, sensor_id, name, **sensor_kwargs)
 create_companion_sensors (config, parent)

Variables

str CONF_DEVICE_ID = "io_device_id"
str CONF_LINKED_REMOTES = "linked_remotes"
str CONF_DEVICE_TYPE = "io_device_type"
str CONF_SUBTYPE = "io_subtype"
str CONF_STATUS_POLL_INTERVAL = "status_poll_interval"
str CONF_DEVICE_NAME_SENSOR_ID = "_device_name_sensor_id"
str CONF_ACTIVE_ISSUE_SENSOR_ID = "_active_issue_sensor_id"
str CONF_RSSI_SENSOR_ID = "_rssi_sensor_id"
str CONF_LAST_CONTACT_SENSOR_ID = "_last_contact_sensor_id"
str CONF_EXCHANGE_FAILURES_SENSOR_ID = "_exchange_failures_sensor_id"
 IOHomeDeviceNameTextSensor
 IOHomeActiveIssueTextSensor
 IOHomeRssiSensor = home_io_control_ns.class_("IOHomeRssiSensor", sensor.Sensor, cg.Component)
 IOHomeLastContactSensor
 IOHomeExchangeFailuresSensor
tuple _COMPANION_SENSOR_IDS

Function Documentation

◆ _companion_sensor_name()

home_io_control.platform_common._companion_sensor_name ( config,
suffix )
protected
Derive a companion sensor's entity name from the parent entity name.

Definition at line 87 of file platform_common.py.

◆ _create_companion_text_sensor()

home_io_control.platform_common._create_companion_text_sensor ( config,
parent,
sensor_id,
name,
disabled_by_default )
protected
Shared body for the auto-generated companion `text_sensor:` entities.

Definition at line 180 of file platform_common.py.

◆ _create_link_health_sensor()

home_io_control.platform_common._create_link_health_sensor ( config,
parent,
sensor_id,
name,
** sensor_kwargs )
protected
Shared body for the three auto-generated link-health `sensor:` companions.

All three (RSSI, Last Contact, Exchange Failures) are numeric, diagnostic, and disabled by
default (noise control); only the name and sensor-specific schema keys
(unit/device_class/state_class/accuracy_decimals) differ between them, so those are the
only things each call in create_companion_sensors() supplies.

Definition at line 194 of file platform_common.py.

◆ companion_id_base()

home_io_control.platform_common.companion_id_base ( config,
parent_id_key )
Return the shared ID prefix for a platform's companion entity IDs.

ESPHome 2026.x sizes its runtime component vector (StaticVector) from the number of
component IDs known at the end of schema validation — before to_code() runs.  If
companion entities are only created inside to_code(), their IDs are not counted and
the StaticVector overflows at runtime, silently dropping later components whose
setup() then never executes.  Companion IDs must therefore be declared during
validation, and they all share the prefix returned here.

``parent_id_key`` differs per platform: light reads the entity ID from
CONF_OUTPUT_ID, while cover, switch and lock read it from CONF_ID.

Definition at line 95 of file platform_common.py.

◆ create_companion_sensors()

home_io_control.platform_common.create_companion_sensors ( config,
parent )
Create and register every auto-generated companion diagnostic sensor.

Single to_code() entry point for the device-bound platforms (the counterpart of
inject_companion_sensor_ids()), so adding a companion touches this module only:

- Device Name: disabled by default (clutter control).
- Active Issue: the one enabled-by-default companion — it is the headline diagnostic
  value that turns a silently-ignored command into a self-explained one (e.g. a
  wind/rain lockout), so users should see it without an opt-in step. Empty except while
  a CMD_ERROR_RESP reason is outstanding; see IOHomeActiveIssueTextSensor.
- RSSI / Last Contact / Exchange Failures: numeric link-health diagnostics, disabled by
  default (noise control). Last Contact publishes seconds since the last frame from the
  device (an age, not a Home Assistant timestamp) and keeps counting up between frames via
  its own heartbeat; see IOHomeLastContactSensor.

Definition at line 223 of file platform_common.py.

Here is the call graph for this function:

◆ inject_companion_sensor_ids()

home_io_control.platform_common.inject_companion_sensor_ids ( config,
parent_id_key )
Declare every auto-generated companion sensor ID during schema validation.

Shared post-validator body for every device-bound platform, covering all entries in
_COMPANION_SENSOR_IDS. See companion_id_base() for why the IDs must be declared at
validation time rather than in to_code().

Definition at line 116 of file platform_common.py.

Here is the call graph for this function:

◆ platform_schema_extension()

home_io_control.platform_common.platform_schema_extension ( )
Return the shared schema keys every device-bound platform extends with.

Definition at line 131 of file platform_common.py.

◆ wire_device_binding()

home_io_control.platform_common.wire_device_binding ( var,
parent,
config )
Emit the shared to_code() wiring that binds an entity to its hub device.

Covers set_parent / set_device_id, the optional device type / subtype / status
poll interval, and the linked-remotes registration loop — identical across all
four device-bound platforms.

Definition at line 144 of file platform_common.py.

Variable Documentation

◆ _COMPANION_SENSOR_IDS

tuple home_io_control.platform_common._COMPANION_SENSOR_IDS
protected
Initial value:
1= (
2 (CONF_DEVICE_NAME_SENSOR_ID, "device_name_sensor", IOHomeDeviceNameTextSensor),
3 (CONF_ACTIVE_ISSUE_SENSOR_ID, "active_issue_sensor", IOHomeActiveIssueTextSensor),
4 (CONF_RSSI_SENSOR_ID, "rssi_sensor", IOHomeRssiSensor),
5 (CONF_LAST_CONTACT_SENSOR_ID, "last_contact_sensor", IOHomeLastContactSensor),
6 (CONF_EXCHANGE_FAILURES_SENSOR_ID, "exchange_failures_sensor", IOHomeExchangeFailuresSensor),
7)

Definition at line 78 of file platform_common.py.

◆ CONF_ACTIVE_ISSUE_SENSOR_ID

str home_io_control.platform_common.CONF_ACTIVE_ISSUE_SENSOR_ID = "_active_issue_sensor_id"

Definition at line 56 of file platform_common.py.

◆ CONF_DEVICE_ID

str home_io_control.platform_common.CONF_DEVICE_ID = "io_device_id"

Definition at line 47 of file platform_common.py.

◆ CONF_DEVICE_NAME_SENSOR_ID

str home_io_control.platform_common.CONF_DEVICE_NAME_SENSOR_ID = "_device_name_sensor_id"

Definition at line 54 of file platform_common.py.

◆ CONF_DEVICE_TYPE

str home_io_control.platform_common.CONF_DEVICE_TYPE = "io_device_type"

Definition at line 49 of file platform_common.py.

◆ CONF_EXCHANGE_FAILURES_SENSOR_ID

str home_io_control.platform_common.CONF_EXCHANGE_FAILURES_SENSOR_ID = "_exchange_failures_sensor_id"

Definition at line 60 of file platform_common.py.

◆ CONF_LAST_CONTACT_SENSOR_ID

str home_io_control.platform_common.CONF_LAST_CONTACT_SENSOR_ID = "_last_contact_sensor_id"

Definition at line 59 of file platform_common.py.

◆ CONF_LINKED_REMOTES

str home_io_control.platform_common.CONF_LINKED_REMOTES = "linked_remotes"

Definition at line 48 of file platform_common.py.

◆ CONF_RSSI_SENSOR_ID

str home_io_control.platform_common.CONF_RSSI_SENSOR_ID = "_rssi_sensor_id"

Definition at line 58 of file platform_common.py.

◆ CONF_STATUS_POLL_INTERVAL

str home_io_control.platform_common.CONF_STATUS_POLL_INTERVAL = "status_poll_interval"

Definition at line 51 of file platform_common.py.

◆ CONF_SUBTYPE

str home_io_control.platform_common.CONF_SUBTYPE = "io_subtype"

Definition at line 50 of file platform_common.py.

◆ IOHomeActiveIssueTextSensor

home_io_control.platform_common.IOHomeActiveIssueTextSensor
Initial value:
1= home_io_control_ns.class_(
2 "IOHomeActiveIssueTextSensor", text_sensor.TextSensor, cg.Component
3)

Definition at line 65 of file platform_common.py.

◆ IOHomeDeviceNameTextSensor

home_io_control.platform_common.IOHomeDeviceNameTextSensor
Initial value:
1= home_io_control_ns.class_(
2 "IOHomeDeviceNameTextSensor", text_sensor.TextSensor, cg.Component
3)

Definition at line 62 of file platform_common.py.

◆ IOHomeExchangeFailuresSensor

home_io_control.platform_common.IOHomeExchangeFailuresSensor
Initial value:
1= home_io_control_ns.class_(
2 "IOHomeExchangeFailuresSensor", sensor.Sensor, cg.Component
3)

Definition at line 72 of file platform_common.py.

◆ IOHomeLastContactSensor

home_io_control.platform_common.IOHomeLastContactSensor
Initial value:
1= home_io_control_ns.class_(
2 "IOHomeLastContactSensor", sensor.Sensor, cg.Component
3)

Definition at line 69 of file platform_common.py.

◆ IOHomeRssiSensor

home_io_control.platform_common.IOHomeRssiSensor = home_io_control_ns.class_("IOHomeRssiSensor", sensor.Sensor, cg.Component)

Definition at line 68 of file platform_common.py.