pyg90alarm.notifications.base
Implements support for notifications/alerts sent by G90 alarm panel.
Classes
|
Represents alert received from the device. |
|
Implements support for notifications/alerts sent by alarm panel. |
- class pyg90alarm.notifications.base.G90DeviceAlert(type, event_id, source, state, zone_name, device_id, unix_time, resv4, other)
Bases:
objectRepresents alert received from the device.
- class pyg90alarm.notifications.base.G90NotificationsBase(protocol_factory)
Bases:
objectImplements support for notifications/alerts sent by alarm panel.
There is a basic check to ensure only notifications/alerts from the correct device are processed - the check uses the host and port of the device, and the device ID (GUID) that is set by the ancestor class that implements the commands (e.g.
G90Alarm). The latter to work correctly needs a command to be performed first, one that fetches device GUID and then stores it usingdevice_id(e.g.G90Alarm.get_host_info()).- handle_notification(notification)
Handles notification received from the device.
- Parameters:
notification (
G90Notification) – The notification to handle.- Return type:
- handle_alert(alert, verify_device_id=True)
Handles alert received from the device.
- Parameters:
alert (
G90DeviceAlert) – The alert to handle.verify_device_id (
bool) – Whether to verify the device ID (GUID) in the alert. If set to False, the device ID will not be verified.
- Return type:
- property listener_started: bool
Indicates if the listener of the device notifications has been started.
- property device_id: str | None
The ID (GUID) of the panel being communicated with thru commands.
Available when any panel command receives it from the device (GETHOSTINFO local command or Hello / HelloDiscovery cloud ones).
- property last_device_packet_time: datetime | None
Returns the timestamp of the last packet received from the device.
This property can be used to monitor the communication health with the device.
- set_last_device_packet_time()
Updates the timestamp of the last packet received from the device.
This method is called internally when a packet is received from the device.
- Return type: