pyg90alarm.entities.device_list
Device list.
Classes
|
Device list class. |
- class pyg90alarm.entities.device_list.G90DeviceList(parent)
Bases:
G90BaseList[G90Device]Device list class.
- async register(definition_name, room_id, timeout, name=None)
Register the devices (switches) to the panel.
Contrary to registering the sensors, the registration of devices does not have an associated notification from the panel, hence the list of devices is polled to determine when new device is added.
- Parameters:
definition_name (
str) – Name of the device definition to register.room_id (
int) – ID of the room to assign the device to.timeout (
float) – Timeout in seconds to wait for the device to be added.name (
str|None) – Optional name for the device, if not provided, the name from the definition will be used.
- Raises:
G90EntityRegistrationError – If the device could not be registered or found after the registration.
- Return type:
- Returns:
G90Device: The registered device entity.
- property entities: List[T]
Return the list of entities.
update()is called if the list is empty.- Returns:
List of entities
- async find(idx, name, exclude_unavailable, subindex=0)
Finds entity by index, subindex and name.
- async find_by_idx(idx, exclude_unavailable, subindex=0)
Finds entity by index.
- async find_free_idx()
Finds the first free index in the list.
The index is from protocol point of view (.index attribute of the protocol data), not the index in the list. The index is required when registering a new entity on the panel.
- Return type:
- Returns:
Free index
- property list_change_callback: Callable[[T, bool], None] | Callable[[T, bool], Coroutine[None, None, None]] | None
List change callback.
Invoked when the list of entities is changed, i.e. when a new entity is added or an existing one is updated.
- Returns:
Callback
- async update()
Update the list of entities from the panel.
- Return type:
List[TypeVar(T, bound=G90BaseEntity)]- Returns:
List of entities