pybragerone.models.events¶
Event bus and event classes for pybragerone.
Classes
|
Per-module alarm count changed (REST prime or Socket.IO push). |
|
Library ↔ Brager cloud Socket.IO session (client transport health). |
|
Event bus for managing parameter update events. |
|
Feature changed event representing a change in device feature state. |
|
Module ↔ Brager cloud connectivity (SPA |
|
Parameter update event carrying value and metadata updates. |
- class pybragerone.models.events.AlarmQuantityChanged(devid: str, quantity: int | None, source: ~typing.Literal['rest', 'ws'], changed: bool = True, ts: float = <factory>)[source]¶
Bases:
objectPer-module alarm count changed (REST prime or Socket.IO push).
- Parameters:
- class pybragerone.models.events.CloudSessionConnectivity(up: bool, source: ~typing.Literal['connect', 'disconnect', 'stop'], changed: bool = True, ts: float = <factory>)[source]¶
Bases:
objectLibrary ↔ Brager cloud Socket.IO session (client transport health).
Distinct from
ModuleConnectivity(module ↔ cloudconnectedAt). When this session drops the gateway self-heals: Engine.IO reset on connect timeout, supervisor reconnect, resubscribe + REST prime, REST re-prime on the connectivity poll while the socket is still down, and after repeated stale-ParamUpdate cycles a hard WS restart (SPA parity:connect→ModulesService.connect+ REST parameters). Consumers registerBragerOneGateway.on_cloud_sessionor pollBragerOneGateway.ws_session_up()so an outage is detectable without looking like a plant module going offline.
- class pybragerone.models.events.EventBus[source]¶
Bases:
objectEvent bus for managing parameter update events.
Provides publish-subscribe functionality for parameter updates with sequence numbering and thread-safe operations.
- async publish(upd: ParamUpdate)[source]¶
Publish an event to all subscribers.
- Parameters:
upd (
ParamUpdate) – The parameter update event to publish.- Return type:
- async subscribe()[source]¶
Subscribe to events.
- Returns:
AsyncGenerator[ParamUpdate] – An async iterator that yields parameter update events.- Return type:
- class pybragerone.models.events.FeatureChanged(devid: str, feature: str, value: bool)[source]¶
Bases:
objectFeature changed event representing a change in device feature state.
- class pybragerone.models.events.ModuleConnectivity(devid: str, online: bool, source: ~typing.Literal['rest', 'ws', 'derived'], connected_at: int | None = None, gateway: dict[str, ~typing.Any] | None = None, online_changed: bool = True, metadata_changed: bool = False, ts: float = <factory>)[source]¶
Bases:
objectModule ↔ Brager cloud connectivity (SPA
connectedAt).This is not published on
EventBus(which staysParamUpdate-only for Home Assistant compatibility). Consumers registerBragerOneGateway.on_module_connectivityor pollBragerOneGateway.module_online().Mirrors the SPA module card / connection modal: online iff
connectedAtis truthy (upstream uses0as offline). Live updates arrive on Socket.IOapp:module:connection:status:changedwith{devid: {connectedAt, gateway}}.When the module is offline there is nothing the client can repair — observe and wait. The library’s own Socket.IO session is a separate layer (
CloudSessionConnectivity) and must never be folded intoonline.- Parameters:
- connected_at: int | None = None¶
Where the observation came from (REST poll, WS push, or derived absence).