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

Functions

 validate_radio_transport (config)
 validate_fem (config)
 device_type_name (device_type)
 device_models (device_type, subtype=0)
 device_features (device_type, subtype=0, model=0)
 kind_is_experimental (device_type, subtype=0, model=0)
 _resolve_named_or_raw_token (token, options, max_value=0xFF)
 _resolve_device_type_token (token)
 validate_device_type (value)
 validate_manufacturer (value)
 device_type_expression (value)
 device_model_expression (value)
 validate_device_model_name (value)
 validate_node_id (value)
 validate_system_key (value)
 validate_device_id (value)
 inherit_esphome_device (companion_config, parent_config)
 validate_linked_remote_entry (value)
 _validate_min_interval (value, minimum_ms, key)
 validate_status_poll_interval (value)
 validate_rain_sensor_poll_interval (value)
 validate_sun_level_poll_interval (value)
 validate_battery_level_poll_interval (value)
 validate_status_refresh_interval (value)

Variables

 _LOGGER = logging.getLogger(__name__)
dict PA_PIN_OPTIONS
dict RADIO_TYPE_OPTIONS
 SPI_RADIO_TYPES = frozenset({"sx1276", "sx1262", "lr1121"})
dict TCXO_VOLTAGE_OPTIONS
 FemProfile = home_io_control_ns.enum("FemProfile", is_class=True)
dict FEM_PROFILES
dict FEM_REQUIRED_PINS
dict FEM_TX_POWER_MAX_QUIET
int DEVICE_TYPE_MAX = 0x3FF
dict DEVICE_TYPE_OPTIONS
dict DEFAULT_COVER_DEVICE_CLASS
int FEATURE_MAIN_PARAMETER_ONLY = 0x0001
int FEATURE_LEVELS = 0x0002
int FEATURE_TILT = 0x0004
int FEATURE_FAVORITE = 0x0008
int FEATURE_VENT = 0x0010
int FEATURE_PARTIAL = 0x0020
int FEATURE_PEDESTRIAN = 0x0040
int FEATURE_EXTENDED_POSITION_FRAME = 0x0080
int FEATURE_WINDOW_COMPANIONS = 0x0100
int FEATURE_INVERTED = 0x0200
int FEATURE_WATER_HEATER = 0x0400
int FEATURE_NIGHT_LIGHT = 0x0800
int KIND_EXPERIMENTAL = 0x8000
dict DEVICE_MODEL_OPTIONS
dict DEVICE_FEATURES
dict NAMED_POSITION_FEATURES
int SUBTYPE_MAIN_PARAMETER_ONLY = 58
dict _DEVICE_TYPE_NAMES = {value: name for name, value in DEVICE_TYPE_OPTIONS.items()}
dict _DEVICE_MODEL_NAMES = {value: name for name, value in DEVICE_MODEL_OPTIONS.items()}
dict RENAMED_DEVICE_TYPES
dict MANUFACTURER_OPTIONS
dict ONEWAY_WIRE_PROFILE_MANUFACTURERS

Function Documentation

◆ _resolve_device_type_token()

_resolve_device_type_token ( token)
protected
Resolve a lowercase, stripped device-type token (name or raw int/hex string) to 0-1023.

Single source of truth for the "named value from DEVICE_TYPE_OPTIONS, else raw integer"
acceptance rule shared by validate_device_type() (io_device_type) and
validate_linked_remote_entry() (the class:<device_type> linked-remotes form) — both accept
the exact same set of device-type spellings, so the lookup lives here once.
@raises ValueError if token is neither a known name nor a parseable integer.
@raises cv.Invalid if token is a renamed device-type name (naming the new one), or parses as an
integer but is out of range 0-1023.

Definition at line 461 of file hub_validators.py.

Here is the call graph for this function:

◆ _resolve_named_or_raw_token()

_resolve_named_or_raw_token ( token,
options,
max_value = 0xFF )
protected
Resolve a lowercase, stripped token (a name from `options`, or a raw int/hex string) to
an integer 0-`max_value`.

Shared "named value, else raw integer" acceptance rule: validate_device_type()/
validate_linked_remote_entry() (DEVICE_TYPE_OPTIONS) and validate_manufacturer()
(MANUFACTURER_OPTIONS) are the same shape of small, protocol-defined enum with an escape
hatch for values this project hasn't named yet, so the lookup lives here once.
@raises ValueError if token is neither a known name nor a parseable integer.
@raises cv.Invalid if token parses as an integer but is out of range.

Definition at line 445 of file hub_validators.py.

◆ _validate_min_interval()

_validate_min_interval ( value,
minimum_ms,
key )
protected
Parse a time period and reject anything shorter than minimum_ms, naming the key.

Definition at line 631 of file hub_validators.py.

◆ device_features()

device_features ( device_type,
subtype = 0,
model = 0 )
The capability word of (io_device_type value, io_subtype, io_model value), as the C++
device_features() answers.

The model row; else the exact row; else, for subtype 58, the main-parameter-only variant of the
type's row (of no capabilities when the type has none); else the type's own row. A subtype without
a row of its own takes the type row's capabilities but never its KIND_EXPERIMENTAL marker: C++
device_is_experimental() reads only the exact row, so the marker names a row, not a family. A node type YAML
has no name for (a raw value) has no row here, so it has no capabilities beyond the subtype-58
rule. ``model`` is a DEVICE_MODEL_OPTIONS value, 0 for none; codegen passes the config's model
through platform_common.config_model().

Definition at line 359 of file hub_validators.py.

Here is the call graph for this function:

◆ device_model_expression()

device_model_expression ( value)
Generate a C++ static_cast expression for a validated DEVICE_MODEL_OPTIONS value.

Definition at line 525 of file hub_validators.py.

◆ device_models()

device_models ( device_type,
subtype = 0 )
The io_model names (io_device_type value, io_subtype) offers, sorted; empty for most kinds.

Definition at line 350 of file hub_validators.py.

Here is the call graph for this function:

◆ device_type_expression()

device_type_expression ( value)
Generate a C++ static_cast expression for a validated device type.

Definition at line 518 of file hub_validators.py.

◆ device_type_name()

device_type_name ( device_type)
The io_device_type name of a node type value, or None for one YAML has no name for.

Definition at line 342 of file hub_validators.py.

◆ inherit_esphome_device()

inherit_esphome_device ( companion_config,
parent_config )
Propagate the parent entity's ESPHome sub-device (YAML `device_id:`) onto a hand-built
companion config dict, so the companion entity groups under the same HA device as its parent.

Lives here, a leaf module, so any platform module can import it without the whole
platform-schema module; platform_common.py re-exports it for cover.py.

Companion entities (diagnostic sensors, cover favorite/vent buttons, ...) are built from
dicts fed straight to e.g. new_text_sensor()/new_button() rather than through the platform's
own cv.Schema(), so they never go through ENTITY_BASE_SCHEMA and never pick up `device_id:`
on their own. esphome.core.entity_helpers.setup_entity() reads it with
`config.get(CONF_DEVICE_ID)`, a truthiness check, so an explicit `None` and an absent key
behave identically; omitted here rather than set to None just to keep the dict shape
identical to a companion with no sub-device at all.

Deliberately not called anywhere for the hub-level dynamic entities (1W identity buttons/
sensors, the arming switches, LR1121 firmware controls, tuning numbers/selects): none of their
parent configs carry a `device_id:` schema slot, since those entities aren't attached to a
single cover/light/switch/lock to inherit one from. `device_id:` grouping is scoped to the
four device-bound platforms; hub-level entities always live on ESPHome's main device.

Definition at line 580 of file hub_validators.py.

◆ kind_is_experimental()

kind_is_experimental ( device_type,
subtype = 0,
model = 0 )
True when no capture or report has confirmed (io_device_type value, io_subtype) on a real device.

Reads KIND_EXPERIMENTAL from the same word as the capabilities, so it follows the same fallback as
device_features(): only an exact row (or model row) carries the marker, and a subtype with no row of
its own never inherits it from its type row.

Definition at line 388 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_battery_level_poll_interval()

validate_battery_level_poll_interval ( value)
Validate battery_level_poll_interval is at least MIN_BATTERY_LEVEL_POLL_INTERVAL_MS.

Definition at line 660 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_device_id()

validate_device_id ( value)
Validate io_device_id as exactly 6 hex characters (3 bytes).

Definition at line 568 of file hub_validators.py.

◆ validate_device_model_name()

validate_device_model_name ( value)
Validate io_model as one of the DEVICE_MODEL_OPTIONS names (lowercase).

Whether the declared io_device_type / io_subtype offers the model is
platform_common.validate_device_model()'s job: it needs the whole entry.

Definition at line 530 of file hub_validators.py.

◆ validate_device_type()

validate_device_type ( value)
Validate io_device_type as a named string or integer 0-1023.

Definition at line 477 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_fem()

validate_fem ( config)
Cross-key validation for `fem:` (ADR 0035): which front-end part's control behaviour the
SX1262 driver applies to fem_pa_pin (and, for the two parts that have one, fem_en_pin), never
which GPIO numbers to use for them -- those are always the board package's job, the same as
every other radio pin. Requires radio_type: sx1262 (the raw FEM pins are silently ignored on
every other chip -- select_and_construct_radio_() only ever hands them to RadioSX1262 -- so a
mismatched radio_type would configure hardware the driver never drives), and that every pin
this profile's behaviour needs is actually present, naming exactly which is missing rather
than leaving the driver to silently no-op on a null pin. Also warns when tx_power looks likely
to push this FEM's antenna-port power over a typical 868 MHz SRD limit -- radio_sx1262.cpp's
own init() logs the actual per-part estimate this warning can only gesture at without knowing
the front-end part's exact gain table here too.

Definition at line 143 of file hub_validators.py.

◆ validate_linked_remote_entry()

validate_linked_remote_entry ( value)
Validate a linked_remotes entry: either a device ID or 'class:<device_type>'.

The class form matches how 1W remotes address a typed broadcast (e.g. "all awnings")
rather than a single node, so one entry can cover many same-type devices without
enumerating each one. Shares _resolve_device_type_token() with validate_device_type()
so a type without a named YAML alias yet (e.g. discovered via pairing) can still be
class-linked. Normalized to 'class:0x<HH>' (uppercase hex) so wire_device_binding() can
parse the type directly without a second DEVICE_TYPE_OPTIONS lookup; bare device IDs are
validated exactly as before and behave identically.

Definition at line 606 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_manufacturer()

validate_manufacturer ( value)
Validate manufacturer as a named string (MANUFACTURER_OPTIONS) or integer 0-255.

Mirrors validate_device_type() exactly (same "name, else raw integer" shape via
_resolve_named_or_raw_token()) — a manufacturer ID is the same kind of small,
protocol-defined enum, it just has no linked_remotes-style second caller.

Definition at line 496 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_node_id()

validate_node_id ( value)
Validate node_id as exactly 6 hex characters (3 bytes).

Definition at line 544 of file hub_validators.py.

◆ validate_radio_transport()

validate_radio_transport ( config)
Require the SPI device keys for a radio on the SPI bus. The schema takes them as optional
(``spi.spi_device_schema(False, ...)``) so that the requirement follows ``radio_type`` here,
in one place, rather than being hard-wired into the schema for every radio.

Definition at line 129 of file hub_validators.py.

◆ validate_rain_sensor_poll_interval()

validate_rain_sensor_poll_interval ( value)
Validate rain_sensor_poll_interval is at least MIN_RAIN_SENSOR_POLL_INTERVAL_MS.

Definition at line 646 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_status_poll_interval()

validate_status_poll_interval ( value)
Validate status_poll_interval is at least MIN_STATUS_POLL_INTERVAL_MS.

Definition at line 639 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_status_refresh_interval()

validate_status_refresh_interval ( value)
Validate status_refresh_interval is at least MIN_STATUS_REFRESH_INTERVAL_MS.

Definition at line 667 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_sun_level_poll_interval()

validate_sun_level_poll_interval ( value)
Validate sun_level_poll_interval is at least MIN_SUN_LEVEL_POLL_INTERVAL_MS.

Definition at line 653 of file hub_validators.py.

Here is the call graph for this function:

◆ validate_system_key()

validate_system_key ( value)
Validate system_key as exactly 32 hex characters (16 bytes).

Definition at line 556 of file hub_validators.py.

Variable Documentation

◆ _DEVICE_MODEL_NAMES

dict home_io_control.hub_validators._DEVICE_MODEL_NAMES = {value: name for name, value in DEVICE_MODEL_OPTIONS.items()}
protected

Definition at line 347 of file hub_validators.py.

◆ _DEVICE_TYPE_NAMES

dict home_io_control.hub_validators._DEVICE_TYPE_NAMES = {value: name for name, value in DEVICE_TYPE_OPTIONS.items()}
protected

Definition at line 339 of file hub_validators.py.

◆ _LOGGER

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

Definition at line 49 of file hub_validators.py.

◆ DEFAULT_COVER_DEVICE_CLASS

dict home_io_control.hub_validators.DEFAULT_COVER_DEVICE_CLASS
Initial value:
= {
"garage_opener": DEVICE_CLASS_GARAGE,
"gate_opener": DEVICE_CLASS_GATE,
"rolling_door_opener": DEVICE_CLASS_DOOR,
"window_opener": DEVICE_CLASS_WINDOW,
"sliding_window": DEVICE_CLASS_WINDOW,
"roller_shutter": DEVICE_CLASS_SHUTTER,
"dual_roller_shutter": DEVICE_CLASS_SHUTTER,
"swinging_shutter": DEVICE_CLASS_SHUTTER,
"interior_venetian_blind": DEVICE_CLASS_BLIND,
"exterior_venetian_blind": DEVICE_CLASS_BLIND,
"louvre_blind": DEVICE_CLASS_BLIND,
"vertical_interior_blind": DEVICE_CLASS_SHADE,
"curtain_track": DEVICE_CLASS_CURTAIN,
"horizontal_awning": DEVICE_CLASS_AWNING,
"vertical_exterior_awning": DEVICE_CLASS_AWNING,
}

Definition at line 226 of file hub_validators.py.

◆ DEVICE_FEATURES

dict home_io_control.hub_validators.DEVICE_FEATURES

Definition at line 282 of file hub_validators.py.

◆ DEVICE_MODEL_OPTIONS

dict home_io_control.hub_validators.DEVICE_MODEL_OPTIONS
Initial value:
= {
"towel_dryer": 1,
"heater_with_light": 2,
}

Definition at line 272 of file hub_validators.py.

◆ DEVICE_TYPE_MAX

int home_io_control.hub_validators.DEVICE_TYPE_MAX = 0x3FF

Definition at line 192 of file hub_validators.py.

◆ DEVICE_TYPE_OPTIONS

dict home_io_control.hub_validators.DEVICE_TYPE_OPTIONS
Initial value:
= {
"unknown": 0x00,
"interior_venetian_blind": 0x01,
"roller_shutter": 0x02,
"vertical_exterior_awning": 0x03,
"window_opener": 0x04,
"garage_opener": 0x05,
"light": 0x06,
"gate_opener": 0x07,
"rolling_door_opener": 0x08,
"lock": 0x09,
"vertical_interior_blind": 0x0A,
"dual_roller_shutter": 0x0D,
"heating_temperature_interface": 0x0E,
"on_off_switch": 0x0F,
"horizontal_awning": 0x10,
"exterior_venetian_blind": 0x11,
"louvre_blind": 0x12,
"curtain_track": 0x13,
"exterior_heating": 0x15,
"heat_pump": 0x16,
"intrusion_alarm": 0x17,
"swinging_shutter": 0x18,
"sliding_window": 0x1B,
"bioclimatic_pergola": 0x1D,
"domestic_hot_water": 0x33,
"electrical_heater": 0x34,
}

Definition at line 194 of file hub_validators.py.

◆ FEATURE_EXTENDED_POSITION_FRAME

int home_io_control.hub_validators.FEATURE_EXTENDED_POSITION_FRAME = 0x0080

Definition at line 258 of file hub_validators.py.

◆ FEATURE_FAVORITE

int home_io_control.hub_validators.FEATURE_FAVORITE = 0x0008

Definition at line 254 of file hub_validators.py.

◆ FEATURE_INVERTED

int home_io_control.hub_validators.FEATURE_INVERTED = 0x0200

Definition at line 260 of file hub_validators.py.

◆ FEATURE_LEVELS

int home_io_control.hub_validators.FEATURE_LEVELS = 0x0002

Definition at line 252 of file hub_validators.py.

◆ FEATURE_MAIN_PARAMETER_ONLY

int home_io_control.hub_validators.FEATURE_MAIN_PARAMETER_ONLY = 0x0001

Definition at line 251 of file hub_validators.py.

◆ FEATURE_NIGHT_LIGHT

int home_io_control.hub_validators.FEATURE_NIGHT_LIGHT = 0x0800

Definition at line 262 of file hub_validators.py.

◆ FEATURE_PARTIAL

int home_io_control.hub_validators.FEATURE_PARTIAL = 0x0020

Definition at line 256 of file hub_validators.py.

◆ FEATURE_PEDESTRIAN

int home_io_control.hub_validators.FEATURE_PEDESTRIAN = 0x0040

Definition at line 257 of file hub_validators.py.

◆ FEATURE_TILT

int home_io_control.hub_validators.FEATURE_TILT = 0x0004

Definition at line 253 of file hub_validators.py.

◆ FEATURE_VENT

int home_io_control.hub_validators.FEATURE_VENT = 0x0010

Definition at line 255 of file hub_validators.py.

◆ FEATURE_WATER_HEATER

int home_io_control.hub_validators.FEATURE_WATER_HEATER = 0x0400

Definition at line 261 of file hub_validators.py.

◆ FEATURE_WINDOW_COMPANIONS

int home_io_control.hub_validators.FEATURE_WINDOW_COMPANIONS = 0x0100

Definition at line 259 of file hub_validators.py.

◆ FEM_PROFILES

dict home_io_control.hub_validators.FEM_PROFILES
Initial value:
= {
"none": FemProfile.NONE,
"gc1109": FemProfile.GC1109, # Heltec WiFi LoRa 32 V4.2
"kct8103l": FemProfile.KCT8103L, # Heltec WiFi LoRa 32 V4.3 / V4 R8
"xy16p35": FemProfile.XY16P35, # LilyGO T-Beam 1W SX1262
}

Definition at line 94 of file hub_validators.py.

◆ FEM_REQUIRED_PINS

dict home_io_control.hub_validators.FEM_REQUIRED_PINS
Initial value:
= {
"gc1109": (CONF_VFEM_PIN, CONF_FEM_EN_PIN, CONF_FEM_PA_PIN),
"kct8103l": (CONF_VFEM_PIN, CONF_FEM_EN_PIN, CONF_FEM_PA_PIN),
"xy16p35": (CONF_VFEM_PIN, CONF_FEM_PA_PIN),
}

Definition at line 109 of file hub_validators.py.

◆ FEM_TX_POWER_MAX_QUIET

dict home_io_control.hub_validators.FEM_TX_POWER_MAX_QUIET
Initial value:
= {
"gc1109": 3,
"kct8103l": 1,
"xy16p35": 0,
}

Definition at line 122 of file hub_validators.py.

◆ FemProfile

home_io_control.hub_validators.FemProfile = home_io_control_ns.enum("FemProfile", is_class=True)

Definition at line 93 of file hub_validators.py.

◆ KIND_EXPERIMENTAL

int home_io_control.hub_validators.KIND_EXPERIMENTAL = 0x8000

Definition at line 266 of file hub_validators.py.

◆ MANUFACTURER_OPTIONS

dict home_io_control.hub_validators.MANUFACTURER_OPTIONS
Initial value:
= {
"velux": 0x01,
"somfy": 0x02,
"honeywell": 0x03,
"hormann": 0x04,
"assa_abloy": 0x05,
"niko": 0x06,
"window_master": 0x07,
"renson": 0x08,
"ciat": 0x09,
"secuyou": 0x0A,
"overkiz": 0x0B,
"atlantic_group": 0x0C,
}

Definition at line 421 of file hub_validators.py.

◆ NAMED_POSITION_FEATURES

dict home_io_control.hub_validators.NAMED_POSITION_FEATURES
Initial value:
= {
"FAVORITE": 0x0008,
"VENT": 0x0010,
"PEDESTRIAN": 0x0040,
"PARTIAL": 0x0020,
}

Definition at line 329 of file hub_validators.py.

◆ ONEWAY_WIRE_PROFILE_MANUFACTURERS

dict home_io_control.hub_validators.ONEWAY_WIRE_PROFILE_MANUFACTURERS
Initial value:
= {
MANUFACTURER_OPTIONS["somfy"],
MANUFACTURER_OPTIONS["velux"],
}

Definition at line 439 of file hub_validators.py.

◆ PA_PIN_OPTIONS

dict home_io_control.hub_validators.PA_PIN_OPTIONS
Initial value:
= {
"BOOST": 0x80,
"RFO": 0x00,
}

Definition at line 52 of file hub_validators.py.

◆ RADIO_TYPE_OPTIONS

dict home_io_control.hub_validators.RADIO_TYPE_OPTIONS
Initial value:
= {
"sx1276": "sx1276",
"sx1262": "sx1262",
"lr1121": "lr1121",
}

Definition at line 57 of file hub_validators.py.

◆ RENAMED_DEVICE_TYPES

dict home_io_control.hub_validators.RENAMED_DEVICE_TYPES
Initial value:
= {
"screen": (
"device type 'screen' no longer exists: type 11 is a secure configuration device, not an "
"actuator. Use the type Scan Paired Devices reports for your device, usually "
"'vertical_exterior_awning' or 'vertical_interior_blind'"
),
"blind": "device type 'blind' was renamed: use 'vertical_interior_blind' instead",
"venetian_blind": "device type 'venetian_blind' was renamed: use 'interior_venetian_blind' instead",
"awning": "device type 'awning' was renamed: use 'vertical_exterior_awning' instead",
"dual_shutter": "device type 'dual_shutter' was renamed: use 'dual_roller_shutter' instead",
"external_venetian_blind": (
"device type 'external_venetian_blind' was renamed: use 'exterior_venetian_blind' instead"
),
}

Definition at line 400 of file hub_validators.py.

◆ SPI_RADIO_TYPES

home_io_control.hub_validators.SPI_RADIO_TYPES = frozenset({"sx1276", "sx1262", "lr1121"})

Definition at line 66 of file hub_validators.py.

◆ SUBTYPE_MAIN_PARAMETER_ONLY

int home_io_control.hub_validators.SUBTYPE_MAIN_PARAMETER_ONLY = 58

Definition at line 337 of file hub_validators.py.

◆ TCXO_VOLTAGE_OPTIONS

dict home_io_control.hub_validators.TCXO_VOLTAGE_OPTIONS
Initial value:
= {
"1_6V": 0x00,
"1_7V": 0x01,
"1_8V": 0x02,
"2_2V": 0x03,
"2_4V": 0x04,
"2_7V": 0x05,
"3_0V": 0x06,
"3_3V": 0x07,
"NONE": 0xFF,
}

Definition at line 73 of file hub_validators.py.