Skip to content

aiovantage.controllers

Controllers for managing collections of objects from the Vantage system.

Controllers are responsible for fetching objects, fetching their state, and keeping the state up to date.

Some controllers manage a single type of object, while others handle multiple types. In controllers where multiple object types are managed, they are typically conceptually related through shared behavior rather than a strict class hierarchy. These types of controllers typically hold objects which implement one or more common interfaces. For examples, objects in the BlindsController all implement the BlindInterface.

Controllers implement QuerySet, which provides a number of methods for filtering and finding objects, such as filter and get.

Controllers also implement EventDispatcher, which allows you to subscribe to events related to the objects managed by the controller with subscribe. The following events are emitted by controllers: ObjectAdded, ObjectUpdated, ObjectDeleted

An instance of every controller type is made available through the main Vantage object.

Classes:

Attributes:

BlindGroupTypes module-attribute

Types managed by the blind groups controller.

BlindTypes module-attribute

Types managed by the blinds controller.

RGBLoadTypes module-attribute

Types managed by the RGB loads controller.

ThermostatTypes module-attribute

Types managed by the thermostats controller.

AnemoSensorsController

AnemoSensorsController(vantage: Vantage)

Bases: Controller[AnemoSensor]

Anemo sensors (wind speed sensors) controller.

AreasController

AreasController(vantage: Vantage)

Bases: Controller[Area]

Areas controller.

BackBoxesController

BackBoxesController(vantage: Vantage)

Bases: Controller[BackBox]

Back boxes controller.

Back boxes typically represent a "gang box" in a wall which may contain multiple stations, dimmers, etc. It is mostly useful to know about these devices so we can set up a proper device hierarchy.

Controller

Controller(vantage: Vantage)

Bases: QuerySet[T], EventDispatcher

Base controller for managing collections of Vantage objects.

Parameters:

  • vantage (Vantage) –

    The Vantage instance.

Methods:

  • initialize –

    Populate the controller, and optionally fetch object state.

  • fetch_state –

    Fetch the state properties of all objects managed by this controller.

  • enable_state_monitoring –

    Monitor for state changes on objects managed by this controller.

  • disable_state_monitoring –

    Stop monitoring for state changes on objects managed by this controller.

Attributes:

vantage_types instance-attribute

vantage_types: tuple[str, ...]

The Vantage object types that this controller will fetch.

force_category_status class-attribute instance-attribute

force_category_status: bool = False

Whether to force the controller to handle 'STATUS' categories.

status_type property

status_type: StatusType | None

Return the type of status event that the controller is monitoring.

initialize async

initialize(*, fetch_state: bool = True, enable_state_monitoring: bool = True) -> None

Populate the controller, and optionally fetch object state.

Parameters:

  • fetch_state (bool, default: True ) –

    Whether to fetch the state properties of objects.

  • enable_state_monitoring (bool, default: True ) –

    Whether to monitor for state changes on objects.

fetch_state async

fetch_state() -> None

Fetch the state properties of all objects managed by this controller.

enable_state_monitoring async

enable_state_monitoring() -> None

Monitor for state changes on objects managed by this controller.

disable_state_monitoring async

disable_state_monitoring() -> None

Stop monitoring for state changes on objects managed by this controller.

StatusType

Bases: Enum

The type of status that the controller is using for state monitoring.

Attributes:

  • OBJECT –

    Object status events from the Enhanced Log.

  • CATEGORY –

    Category status events, eg: S:LOAD, S:BLIND, etc.

OBJECT class-attribute instance-attribute

OBJECT = 1

Object status events from the Enhanced Log.

CATEGORY class-attribute instance-attribute

CATEGORY = 2

Category status events, eg: S:LOAD, S:BLIND, etc.

BlindGroupsController

BlindGroupsController(vantage: Vantage)

Bases: Controller[BlindGroupTypes]

Blind groups controller.

BlindsController

BlindsController(vantage: Vantage)

Bases: Controller[BlindTypes]

Blinds controller.

Methods:

  • in_blind_group –

    Return a queryset of all loads in the given blind group.

in_blind_group

in_blind_group(blind_group: BlindGroup) -> QuerySet[BlindTypes]

Return a queryset of all loads in the given blind group.

ButtonsController

ButtonsController(vantage: Vantage)

Bases: Controller[Button]

Buttons controller.

DryContactsController

DryContactsController(vantage: Vantage)

Bases: Controller[DryContact]

Dry contacts controller.

GMemController

GMemController(vantage: Vantage)

Bases: Controller[GMem]

GMem (variables) controller.

LightSensorsController

LightSensorsController(vantage: Vantage)

Bases: Controller[LightSensor]

Light sensors controller.

LoadGroupsController

LoadGroupsController(vantage: Vantage)

Bases: Controller[LoadGroup]

Load groups controller.

LoadsController

LoadsController(vantage: Vantage)

Bases: Controller[Load]

Loads controller.

Methods:

  • in_load_group –

    Return a queryset of all loads in the given load group.

Attributes:

on property

Return a queryset of all loads that are turned on.

off property

off: QuerySet[Load]

Return a queryset of all loads that are turned off.

relays property

relays: QuerySet[Load]

Return a queryset of all loads that are relays.

motors property

motors: QuerySet[Load]

Return a queryset of all loads that are motors.

lights property

lights: QuerySet[Load]

Return a queryset of all loads that are lights.

in_load_group

in_load_group(load_group: LoadGroup) -> QuerySet[Load]

Return a queryset of all loads in the given load group.

MastersController

MastersController(vantage: Vantage)

Bases: Controller[Master]

Masters (InFusion Controllers) controller.

ModulesController

ModulesController(vantage: Vantage)

Bases: Controller[SystemObject]

Modules controller.

Modules are relay or dimming modules connected to the Vantage system.

OmniSensorsController

OmniSensorsController(vantage: Vantage)

Bases: Controller[OmniSensor]

Omni sensors controller.

Omni sensors are generic sensors objects which specify which methods to use when getting or setting data in their object definition, as well as the type of data and a conversion formula.

PortDevicesController

PortDevicesController(vantage: Vantage)

Bases: Controller[PortDevice]

Port devices controller.

Port devices are typically "hubs" that communicate with other devices such as blinds or lighting systems. It is mostly useful to know about these devices so we can set up a proper device hierarchy.

PowerProfilesController

PowerProfilesController(vantage: Vantage)

Bases: Controller[PowerProfile]

Power profiles controller.

QuerySet

QuerySet(data: dict[int, T], populate: Callable[[], Awaitable[None]], filters: list[Callable[[T], Any]] | None = None)

Bases: Iterable[T], AsyncIterator[T]

Queryset class for querying objects from a dictionary.

Querysets are iterable and async iterable, and can be chained together to filter objects.

Parameters:

  • data (dict[int, T]) –

    The data dictionary to query.

  • populate (Callable[[], Awaitable[None]]) –

    A coroutine to populate the data so we don't have a complete dataset before using "async for" loops.

  • filters (list[Callable[[T], Any]] | None, default: None ) –

    A list of filters to apply to the queryset.

Methods:

  • filter –

    Return a queryset of objects that match the given filter.

  • get –

    Get the first object that matches the given filter.

  • aget –

    Asynchronously get the first object that matches the given filter.

  • first –

    Return the first object in the queryset.

  • afirst –

    Asynchronously return the first object in the queryset.

filter

filter(match: Callable[[T], Any]) -> QuerySet[T]
filter(**kwargs: Any) -> QuerySet[T]
filter(*args: Any, **kwargs: Any) -> QuerySet[T]

Return a queryset of objects that match the given filter.

get

get(key: int) -> T | None
get(match: Callable[[T], Any]) -> T | None
get(**kwargs: Any) -> T | None
get(*args: Any, **kwargs: Any) -> T | None

Get the first object that matches the given filter.

aget async

aget(key: int) -> T | None
aget(match: Callable[[T], Any]) -> T | None
aget(**kwargs: Any) -> T | None
aget(*args: Any, **kwargs: Any) -> T | None

Asynchronously get the first object that matches the given filter.

first

first() -> T | None

Return the first object in the queryset.

afirst async

afirst() -> T | None

Asynchronously return the first object in the queryset.

RGBLoadsController

RGBLoadsController(vantage: Vantage)

Bases: Controller[RGBLoadTypes]

RGB loads controller.

Attributes:

on property

Return a queryset of all RGB loads that are turned on.

off property

Return a queryset of all RGB loads that are turned off.

StationsController

StationsController(vantage: Vantage)

Bases: Controller[StationObject]

Stations controller.

Stations typically represent keypads or remote relays. It is mostly useful to know about these devices so we can set up a proper device hierarchy.

TasksController

TasksController(vantage: Vantage)

Bases: Controller[Task]

Tasks controller.

TemperaturesController

TemperaturesController(vantage: Vantage)

Bases: Controller[Temperature]

Temperature device controller.

Temperature devices are device that measure or control temperature.

ThermostatsController

ThermostatsController(vantage: Vantage)

Bases: Controller[ThermostatTypes]

Thermostats controller.