pyg90alarm.notifications.base

Implements support for notifications/alerts sent by G90 alarm panel.

Classes

G90DeviceAlert(type, event_id, source, ...)

Represents alert received from the device.

G90NotificationsBase(protocol_factory)

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: object

Represents alert received from the device.

class pyg90alarm.notifications.base.G90NotificationsBase(protocol_factory)

Bases: object

Implements 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 using device_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:

None

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:

None

handle(data)

Invoked when message is received from the device.

Return type:

None

async listen()

Listens for notifications/alerts from the device.

Return type:

None

property listener_started: bool

Indicates if the listener of the device notifications has been started.

async close()

Closes the listener.

Return type:

None

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).

clear_device_id()

Clears the device ID.

Return type:

None

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:

None

property last_upstream_packet_time: datetime | None

Returns the timestamp of the last packet sent to the upstream server.

This property can be used to monitor the communication health with the cloud/upstream server.

set_last_upstream_packet_time()

Updates the timestamp of the last packet sent to the upstream server.

This method is called internally when a packet is sent to the upstream server.

Return type:

None