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

Functions

 _inject_pairing_result_sensor_id (config)
 _warn_deprecated_platform (config)
 _reject_duplicate_with_hub_flag (config)
 to_code (config)

Variables

 _LOGGER = logging.getLogger(__name__)
list DEPENDENCIES = ["home_io_control"]
str CONF_PAIRING_RESULT_SENSOR_ID = "_pairing_result_sensor_id"
 CONFIG_SCHEMA
 FINAL_VALIDATE_SCHEMA = _reject_duplicate_with_hub_flag

Function Documentation

◆ _inject_pairing_result_sensor_id()

_inject_pairing_result_sensor_id ( config)
protected
Declare the companion pairing-result sensor ID during schema validation.

ESPHome 2026.x sizes its runtime component vector from the number of component IDs
known at the end of schema validation — before to_code() runs. A companion entity
created only in to_code() is not counted and silently drops at runtime. See the
identical pattern (and its full rationale) in platform_common.py::companion_id_base().

Definition at line 44 of file button.py.

◆ _reject_duplicate_with_hub_flag()

_reject_duplicate_with_hub_flag ( config)
protected
Reject having both this legacy entry and the hub's own discover_and_pair_button: true.

Rejected unconditionally, regardless of this entry's own name/device_id -- by default both
create a button named "Discover & Pair" on the same device, which ESPHome's entity-duplicate
validator refuses, but it only notices inside the hub's to_code(), where the resulting
cv.Invalid surfaces as an uncaught traceback rather than a validation message. A renamed or
re-homed entry could in principle coexist without colliding, but forcing the choice here keeps
the guard simple and the migration unambiguous: one pairing trigger, not "two unless you were
careful". Platform modules get their own FINAL_VALIDATE_SCHEMA slot, so this does not touch
__init__.py's (already used for address-collision detection).

Definition at line 102 of file button.py.

◆ _warn_deprecated_platform()

_warn_deprecated_platform ( config)
protected
Warn that this platform is superseded by home_io_control.discover_and_pair_button.

Placed FIRST in CONFIG_SCHEMA's cv.All() chain so the warning still reaches a user whose entry
also has an unrelated validation error. ESPHome runs each entry's schema exactly once per
`esphome config|compile|run`, so this fires once per legacy entry per invocation -- no dedupe
flag needed. A validator rather than to_code()'s first line (ESPHome's own precedent for a
whole-component deprecation) so `esphome config` and the dashboard's validate-only pass show it
too, and to match this component's existing convention of warning from validators.

Definition at line 64 of file button.py.

◆ to_code()

to_code ( config)

Definition at line 127 of file button.py.

Variable Documentation

◆ _LOGGER

home_io_control.button._LOGGER = logging.getLogger(__name__)
protected

Definition at line 36 of file button.py.

◆ CONF_PAIRING_RESULT_SENSOR_ID

str home_io_control.button.CONF_PAIRING_RESULT_SENSOR_ID = "_pairing_result_sensor_id"

Definition at line 41 of file button.py.

◆ CONFIG_SCHEMA

home_io_control.button.CONFIG_SCHEMA
Initial value:
= cv.All(
_warn_deprecated_platform,
button.button_schema(
IOHomeDiscoverButton,
entity_category=ENTITY_CATEGORY_CONFIG,
)
.extend(
{
cv.GenerateID(CONF_HOME_IO_CONTROL_ID): cv.use_id(
IOHomeControlComponent
),
}
)
.extend(cv.COMPONENT_SCHEMA),
_inject_pairing_result_sensor_id,
)

Definition at line 84 of file button.py.

◆ DEPENDENCIES

list home_io_control.button.DEPENDENCIES = ["home_io_control"]

Definition at line 38 of file button.py.

◆ FINAL_VALIDATE_SCHEMA

home_io_control.button.FINAL_VALIDATE_SCHEMA = _reject_duplicate_with_hub_flag

Definition at line 124 of file button.py.