Skip to content

aiovantage.events

Event classes for Vantage controller events.

Classes:

  • Connected –

    Event emitted when a client connection is established.

  • Disconnected –

    Event emitted when the client connection is lost.

  • Reconnected –

    Event emitted when the client connection is re-established.

  • StatusReceived –

    Event emitted when a "S:" status is received.

  • EnhancedLogReceived –

    Event emitted when an "EL:" enhanced log is received.

  • ObjectAdded –

    Event emitted when an object is added to a controller.

  • ObjectUpdated –

    Event emitted when an object is updated.

  • ObjectDeleted –

    Event emitted when an object is removed from a controller.

EventDispatcher

EventDispatcher()

Simple event dispatcher that allows subscription to and emission of events.

Methods:

  • subscribe –

    Register a callback function to be called when an event is emitted.

  • emit –

    Emit an event, notifying all subscribers.

subscribe

subscribe(event_type: type[T], callback: Callable[[T], None]) -> Callable[[], None]

Register a callback function to be called when an event is emitted.

Parameters:

  • event_type (type[T]) –

    Event type to subscribe to.

  • callback (Callable[[T], None]) –

    Callback function to call when an event of this type is emitted.

Returns:

  • Callable[[], None] –

    A function that can be called to unsubscribe from the event.

emit

emit(event: Any) -> None

Emit an event, notifying all subscribers.

Parameters:

  • event (Any) –

    The event to emit.

Connected

Event emitted when a client connection is established.

Disconnected

Event emitted when the client connection is lost.

Reconnected

Event emitted when the client connection is re-established.

StatusReceived dataclass

StatusReceived(category: str, vid: int, args: list[str])

Event emitted when a "S:" status is received.

Attributes:

  • category (str) –

    The status category, eg. "LOAD", "BLIND", etc.

  • vid (int) –

    The unique Vantage ID of the object the status applies to.

  • args (list[str]) –

    The arguments of the status message.

category instance-attribute

category: str

The status category, eg. "LOAD", "BLIND", etc.

vid instance-attribute

vid: int

The unique Vantage ID of the object the status applies to.

args instance-attribute

args: list[str]

The arguments of the status message.

EnhancedLogReceived dataclass

EnhancedLogReceived(log: str)

Event emitted when an "EL:" enhanced log is received.

Attributes:

  • log (str) –

    The enhanced log message.

log instance-attribute

log: str

The enhanced log message.

ObjectAdded dataclass

ObjectAdded(obj: T)

Bases: Generic[T]

Event emitted when an object is added to a controller.

Attributes:

  • obj (T) –

    The object that the event is related to.

obj instance-attribute

obj: T

The object that the event is related to.

ObjectUpdated dataclass

ObjectUpdated(obj: T, attrs_changed: list[str])

Bases: Generic[T]

Event emitted when an object is updated.

Attributes:

  • obj (T) –

    The object that the event is related to.

  • attrs_changed (list[str]) –

    A list of attributes that have changed.

obj instance-attribute

obj: T

The object that the event is related to.

attrs_changed instance-attribute

attrs_changed: list[str]

A list of attributes that have changed.

ObjectDeleted dataclass

ObjectDeleted(obj: T)

Bases: Generic[T]

Event emitted when an object is removed from a controller.

Attributes:

  • obj (T) –

    The object that the event is related to.

obj instance-attribute

obj: T

The object that the event is related to.