Device splitting¶
Some physical devices expose multiple controllable endpoints (multi-zone lights, security sensors, portable AC power toggles). aioafero splits them into separate logical devices so integrations can expose one entity per zone.
How splitting works¶
During discovery, a controller’s
DEVICE_SPLIT_CALLBACKStransforms oneAferoDeviceinto several clones with synthetic IDs.Each clone gets a unique
_id(for example{parent}-light-{instance}).split_identifieron the model enablesStandardMixinproperties:id— the synthetic ID (entity identity)update_id— parent metadevice ID used for API writesinstance— split instance name parsed from the synthetic ID
Implementing a new split type¶
On the primary controller, register a callback in DEVICE_SPLIT_CALLBACKS that
returns CallbackResponse with
split_devices=[...] and remove_original=....
On the split model:
Use a unique synthetic
_id, not the parent metadevice ID.Set
split_identifierconsistently with the ID format.Inherit
StandardMixinwhen the model needsupdate_id/instance.
Existing split patterns¶
Lights — multi-zone
lightinstances; parent may become a Wi-Fi metadata device.Portable ACs —
powertoggle →bridge.switches.Exhaust fans — toggles, fan, and light instances on one unit.
Security systems — sensors extracted to
bridge.security_systems_sensors.
Pollers deduplicate by parent metadevice ID so split entities do not multiply API traffic.