pyg90alarm

Python package to control G90-based alarm systems.

class pyg90alarm.G90Alarm(host, port=12368, reset_occupancy_interval=3.0)

Bases: G90NotificationProtocol

Allows to interact with G90 alarm panel.

Parameters:
  • host (str) – Hostname or IP address of the alarm panel. Since the protocol is UDP-based it is ok to use broadcast or directed broadcast addresses, such as 255.255.255.255 or 10.10.10.255 (the latter assumes the device is on 10.10.10.0/24 network)

  • port (int) – The UDP port of the device where it listens for the protocol commands on WiFi interface, currently the devices don’t allow it to be customized

  • reset_occupancy_interval (float) – The interval upon that the sensors are simulated to go into inactive state.

property alarm_callback: G90CallbackList[Callable[[int, str, Any], None] | Callable[[int, str, Any], Coroutine[None, None, None]]]

The device alarm callback, which is invoked when device alarm triggers.

See also

sensor_callback for compatibility notes

async alarm_phones(force=False)

Provides access to alarm panel phone numbers.

Parameters:

force (bool) – If True, bypass cached value and force device read.

Return type:

G90AlarmPhones

Returns:

Alarm panel phone numbers

property alert_config: G90AlertConfig

Provides alert configuration object.

Returns:

Alert configuration object

async arm_away()

Arms the device in away mode.

Return type:

None

async arm_home()

Arms the device in home mode.

Return type:

None

property armdisarm_callback: G90CallbackList[Callable[[G90ArmDisarmTypes], None] | Callable[[G90ArmDisarmTypes], Coroutine[None, None, None]]]

The device arm/disarm callback, which is invoked when device state changes.

See also

sensor_callback for compatibility notes

async cid_config(force=False)

Provides access to CID (Contact ID) phone reporting configuration.

Parameters:

force (bool) – If True, bypass cached value and force device read.

Return type:

G90CidConfig

Returns:

CID phone reporting configuration

async close_notifications()

Closes the listener for device notifications/alerts.

Return type:

None

async command(code, data=None)

Invokes a command against the alarm panel.

Parameters:
Return type:

List[Any]

Returns:

The result of command invocation

property device_list_change_callback: G90CallbackList[Callable[[G90Device, bool], None] | Callable[[G90Device, bool], Coroutine[None, None, None]]]

Device list change callback, which is invoked when device list changes.

See also

sensor_callback for compatibility notes

property devices: List[G90Device]

Returns the list of devices (switches) configured in the device. Please note it doesn’t update those from the panel except initially when the list if empty.

Returns:

List of devices

async disarm()

Disarms the device.

Return type:

None

async classmethod discover()

Initiates discovering devices available in the same network segment, by using global broadcast address as the destination.

Return type:

List[G90DiscoveredDevice]

Returns:

List of discovered devices

property door_open_close_callback: G90CallbackList[Callable[[int, str, bool], None] | Callable[[int, str, bool], Coroutine[None, None, None]]]

The door open/close callback, which is invoked when door is opened or closed (if corresponding alert is configured on the device).

See also

sensor_callback for compatibility notes

property door_open_when_arming_callback: G90CallbackList[Callable[[int, str], None] | Callable[[int, str], Coroutine[None, None, None]]]

Door open when arming callback, which is invoked when sensor reports the condition.

See also

sensor_callback for compatibility notes

async find_device(idx, name, exclude_unavailable=True)

Finds device by index and name.

Parameters:
  • idx (int) – Device index

  • name (str) – Device name

  • exclude_unavailable (bool) – Flag indicating if unavailable devices should be excluded from the search

Return type:

G90Device | None

Returns:

Device instance

async find_sensor(idx, name, exclude_unavailable=True)

Finds sensor by index and name.

Parameters:
  • idx (int) – Sensor index

  • name (str) – Sensor name

  • exclude_unavailable (bool) – Flag indicating if unavailable sensors should be excluded from the search

Return type:

G90Sensor | None

Returns:

Sensor instance

async get_alert_config()

Provides alert configuration flags, retained for compatibility - using alert_config and G90AlertConfig is preferred.

Return type:

G90AlertConfigFlags

Returns:

The alerts configured

async get_devices()

Provides list of devices (switches) configured in the device, updating them from panel on each call. Multi-node devices, those having multiple ports, are expanded into corresponding number of resulting entries.

Return type:

List[G90Device]

Returns:

List of devices

async get_host_info()

Provides the device information (for example hardware versions, signal levels etc.).

Return type:

G90HostInfo

Returns:

Device information

async get_host_status()

Provides the device status (for example, armed or disarmed, configured phone number, product name etc.).

Return type:

G90HostStatus

Returns:

Device information

async get_sensors()

Provides list of sensors configured in the device, updating them from panel on each call.

Return type:

List[G90Sensor]

Returns:

List of sensors

async get_user_data_crc()

Retieves checksums (CRC) for different on-device databases (history, sensors etc.). Might be used to detect if there is a change in a particular database.

Note

Note that due to a bug in the firmware CRC for sensors and device databases change on each call even if there were no changes

Return type:

G90UserDataCRC

Returns:

Checksums for different databases

async gsm_reboot()

Reboots the GSM module of the alarm panel.

Note that underlying command doesn’t return any result, so there is no feedback from the panel upon execution.

Return type:

None

async history(start=1, count=1)

Retrieves event history from the device.

Parameters:
  • start (int) – Starting record number (one-based)

  • count (int) – Number of records to retrieve

Return type:

List[G90History]

Returns:

List of history entries

property host: str

Returns the hostname or IP address of the alarm panel.

This is the address used for communication with the device.

async host_config(force=False)

Provides access to alarm panel configuration.

Parameters:

force (bool) – If True, bypass cached value and force device read.

Return type:

G90HostConfig

Returns:

Alarm panel configuration

property host_info: G90HostInfo

Property over new get_host_info() method, retained for compatibility.

property host_status: G90HostStatus

Property over new get_host_status() method, retained for compatibility.

property last_device_packet_time: datetime | None

Returns the time of the last packet received from the device.

property last_upstream_packet_time: datetime | None

Returns the time of the last packet received from the upstream server.

async listen_notifications()

Starts internal listener for device notifications/alerts.

Return type:

None

property low_battery_callback: G90CallbackList[Callable[[int, str], None] | Callable[[int, str], Coroutine[None, None, None]]]

Low battery callback, which is invoked when sensor reports the condition.

See also

sensor_callback for compatibility notes

async mcu_reboot()

Reboots the MCU of the alarm panel.

Note that underlying command doesn’t return any result, so there is no feedback from the panel upon execution.

Return type:

None

async net_config(force=False)

Provides access to alarm panel network configuration.

Parameters:

force (bool) – If True, bypass cached value and force device read.

Return type:

G90NetConfig

Returns:

Alarm panel network configuration

async on_alarm(event_id, zone_name, is_tampered)

Invoked when alarm is triggered. Fires corresponding callback if set by the user with alarm_callback.

Please note the method is for internal use by the class.

Parameters:
  • event_id (int) – Index of the sensor triggered alarm

  • zone_name (str) – Sensor name

Return type:

None

async on_armdisarm(state)

Invoked when the device is armed or disarmed. Fires corresponding callback if set by the user with armdisarm_callback.

Please note the method is for internal use by the class.

Parameters:

state (G90ArmDisarmTypes) – Device state (armed, disarmed, armed home)

Return type:

None

async on_device_list_change(device, added)

Invoked when device list is changed.

Fires corresponding callback if set by the user with device_list_change_callback.

Please note the method is for internal use by the class.

Parameters:
  • device (G90Device) – The device being added or removed

  • added (bool) – Flag indicating if the device is added or removed

Return type:

None

async on_door_open_close(event_id, zone_name, is_open)

Invoked when door open/close alert comes from the alarm panel. Fires corresponding callback if set by the user with door_open_close_callback.

Please note the method is for internal use by the class.

See also

on_sensor_activity() method for arguments

Return type:

None

async on_door_open_when_arming(event_id, zone_name)

Invoked when door is open when arming the device. Fires corresponding callback if set by the user with door_open_when_arming_callback.

Please note the method is for internal use by the class.

Parameters:
  • event_id (int) – The index of the sensor being active when the panel is being armed.

  • zone_name (str) – The name of the sensor

Return type:

None

async on_low_battery(event_id, zone_name)

Invoked when the sensor reports on low battery. Fires corresponding callback if set by the user with on_low_battery_callback.

Please note the method is for internal use by the class.

Parameters:
  • event_id (int) – Index of the sensor triggered alarm

  • zone_name (str) – Sensor name

Return type:

None

async on_remote_button_press(event_id, zone_name, button)

Invoked when remote button is pressed. Fires corresponding callback if set by the user with remote_button_press_callback.

Please note the method is for internal use by the class.

Parameters:
  • event_id (int) – Index of the sensor triggered alarm

  • zone_name (str) – Sensor name

  • button (G90RemoteButtonStates) – The button pressed

Return type:

None

async on_rfid_keypad(event_id, zone_name, state)

Invoked when RFID keypad event occurs. Fires corresponding callback if set by the user with rfid_keypad_callback.

Please note the method is for internal use by the class.

Parameters:
  • event_id (int) – Index of the RFID keypad (sensor associated with the RFID keypad)

  • zone_name (str) – Sensor name

  • state (G90RFIDKeypadStates) – The RFID keypad state

Return type:

None

async on_sensor_activity(idx, name, occupancy=True)

Invoked both for sensor notifications and door open/close alerts, since the logic for both is same and could be reused. Fires corresponding callback if set by the user with sensor_callback.

Please note the method is for internal use by the class.

Parameters:
  • idx (int) – The index of the sensor the callback is invoked for. Please note the index is a property of sensor, not the direct index of sensors array

  • name (str) – The name of the sensor, along with the idx parameter it is used to look the sensor up from the sensors list

  • occupancy (bool) – The flag indicating the target sensor state (=occupancy), will always be True for callbacks invoked from alarm panel notifications, and reflects actual sensor state for device alerts (only for door type sensors, if door open/close alerts are enabled)

Return type:

None

async on_sensor_change(sensor_idx, sensor_name, added)

Invoked when sensor is added or removed from the device.

There is no user-visible callback assoiciated with this method, those will be handled by on_sensor_list_change() method.

Please note the method is for internal use by the class.

Parameters:
  • sensor_idx (int) – The index of the sensor being added/removed.

  • sensor_name (str) – The name of the sensor.

  • added (bool) – Flag indicating if the sensor is added or removed

Return type:

None

async on_sensor_list_change(sensor, added)

Invoked when sensor list is changed.

Fires corresponding callback if set by the user with sensor_list_change_callback. Please note the method is for internal use by the class.

Parameters:
  • sensor (G90Sensor) – The sensor being added or removed

  • added (bool) – Flag indicating if the sensor is added or removed

Return type:

None

async on_sos(event_id, zone_name, is_host_sos)

Invoked when SOS alert is triggered. Fires corresponding callback if set by the user with sos_callback.

Please note the method is for internal use by the class.

Parameters:
  • event_id (int) – Index of the sensor triggered alarm

  • zone_name (str) – Sensor name

  • is_host_sos (bool) – Flag indicating if the SOS alert is triggered by the panel itself (host)

Return type:

None

paginated_result(code, start=1, end=None)

Returns asynchronous generator for a paginated command, that is - command operating on a range of records.

Parameters:
  • code (G90Commands) – Command code

  • start (int) – Starting record position (one-based)

  • end (int | None) – Ending record position (one-based)

Return type:

AsyncGenerator[G90PaginatedResponse, None]

Returns:

Asynchronous generator over the result of command invocation.

property port: int

Returns the UDP port number used to communicate with the alarm panel.

By default, this is set to the standard G90 protocol port.

async reboot()

Reboots the entire alarm panel.

The system commands performing reboot of a panel’s module don’t return anything so there is no feedback from the panel upon execution, hence the commands are spaced with delays to allow the panel to process them.

Please be aware that the delays are determined experimentally and might be too long or too short.

Return type:

None

async register_device(definition_name, name=None, timeout=30)

Registers device (relay, switch) with the panel.

Parameters:
  • definition_name (str) – Name of the device definition to register

  • name (str | None) – Optional name of the device to register, if not provided the name will be taken from the definition

  • timeout (float) – Timeout for the registration process, in seconds

Return type:

G90Device

Returns:

Device instance

async register_sensor(definition_name, name=None, timeout=30)

Registers the sensor with the panel.

Parameters:
  • definition_name (str) – Name of the sensor definition to register

  • name (str | None) – Optional name of the sensor to register, if not provided the name will be taken from the definition

  • timeout (float) – Timeout for the registration process, in seconds

Return type:

G90Sensor

Returns:

Sensor instance

property remote_button_press_callback: G90CallbackList[Callable[[int, str, G90RemoteButtonStates], None] | Callable[[int, str, G90RemoteButtonStates], Coroutine[None, None, None]]]

Remote button press callback, which is invoked when remote button is pressed.

See also

sensor_callback for compatibility notes

property rfid_keypad_callback: G90CallbackList[Callable[[int, str, G90RFIDKeypadStates], None] | Callable[[int, str, G90RFIDKeypadStates], Coroutine[None, None, None]]]

RFID keypad callback, which is invoked when RFID keypad event occurs.

See also

sensor_callback for compatibility notes

property sensor_callback: G90CallbackList[Callable[[int, str, bool], None] | Callable[[int, str, bool], Coroutine[None, None, None]]]

Sensor activity callback, which is invoked when sensor activates.

Setting the property will add the callback to the list of (retained for compatilibity with earlier package versions), or G90CallbackList instance could be accessed over the property - G90Alarm(…).sensor_callback.add(callback) or G90Alarm(…).sensor_callback.remove(callback) methods could be used to add or remove the callback, respectively.

property sensor_list_change_callback: G90CallbackList[Callable[[G90Sensor, bool], None] | Callable[[G90Sensor, bool], Coroutine[None, None, None]]]

Sensor list change callback, which is invoked when sensor list changes.

See also

sensor_callback for compatibility notes

property sensors: List[G90Sensor]

Returns the list of sensors configured in the device. Please note it doesn’t update those from the panel except initially when the list if empty.

Returns:

List of sensors

async set_alert_config(flags)

Sets the alert configuration flags, retained for compatibility - using alert_config and G90AlertConfig is preferred.

Return type:

None

async set_cloud_server_address(cloud_ip, cloud_port)

Sets the cloud server address the alarm panel connects to.

Parameters:
  • cloud_ip (str) – IP address of the server to receive cloud protocol notifications, should be reachable from the panel. Typically it is the IP address of the host running the package

  • cloud_port (int) – Port number of the server to receive cloud protocol notifications, should be reachable from the panel

Return type:

None

async sia_config(force=False)

Provides access to SIA Internet reporting configuration.

Parameters:

force (bool) – If True, bypass cached value and force device read.

Return type:

G90SiaConfig

Returns:

SIA Internet reporting configuration

property sms_alert_when_armed: bool

When enabled, allows to save costs on SMS by having corresponding alert enabled only when device is armed.

property sos_callback: G90CallbackList[Callable[[int, str, bool], None] | Callable[[int, str, bool], Coroutine[None, None, None]]]

SOS callback, which is invoked when SOS alert is triggered.

See also

sensor_callback for compatibility notes

async start_simulating_alerts_from_history(interval=5, history_depth=5)

Starts the separate task to simulate device alerts from history entries.

The listener for device notifications will be stopped, so device notifications will not be processed thus resulting in possible duplicated if those could be received from the network.

Parameters:
  • interval (float) – Interval (in seconds) between polling for newer history entities

  • history_depth (int) – Amount of history entries to fetch during each polling cycle

Return type:

None

async stop_simulating_alerts_from_history()

Stops the task simulating device alerts from history entries.

The listener for device notifications will be started back, if it was running when simulation has been started.

Return type:

None

property tamper_callback: G90CallbackList[Callable[[int, str], None] | Callable[[int, str], Coroutine[None, None, None]]]

Tamper callback, which is invoked when sensor reports the condition.

async classmethod targeted_discover(device_id)

Initiates discovering devices available in the same network segment using targeted protocol, that is - specifying target device GUID in the request, so only the specific device should respond to the query.

Parameters:

device_id (str) – GUID of the target device to discover

Return type:

List[G90DiscoveredDeviceTargeted]

Returns:

List of discovered devices

async use_cloud_notifications(cloud_ip, cloud_port, cloud_local_ip='0.0.0.0', cloud_local_port=5678, upstream_host=None, upstream_port=5678, keep_single_connection=True)

Switches to use cloud notifications for device alerts.

Please note the method does not configure the panel for the host to receive the notifications - please invoke G90Alarm.set_cloud_server_address() method to do that. The reason of that is configuring cloud server address on the panel is one-time operation, while the method will be called multiple times.

Parameters:
  • cloud_ip (str) – The IP address of cloud server to connect to, should be reachable from the panel

  • cloud_port (int) – The cloud server port to connect to, should be reachable from the panel

  • cloud_local_ip (str) – Local IP address to bind cloud notifications listener to

  • cloud_local_port (int) – Local port to bind cloud notifications listener to, should match cloud_port above unless network setup dictates otherwise

  • upstream_host (str | None) – Optional upstream host to connect to cloud server through

  • upstream_port (int | None) – Optional upstream port to connect to cloud server through

  • keep_single_connection (bool) – If enabled, keeps a single connection to the upstream cloud server for both sending and receiving data

Return type:

None

async use_local_notifications(notifications_local_ip='0.0.0.0', notifications_local_port=12901)

Switches to use local notifications for device alerts.

Return type:

None

property user_data_crc: G90UserDataCRC

Property over new get_user_data_crc() method, retained for compatibility.

async wifi_reboot()

Reboots the WiFi module of the alarm panel.

Note that underlying command doesn’t return any result, so there is no feedback from the panel upon execution.

Return type:

None

class pyg90alarm.G90BaseCommand(*args, **kwargs)

Bases: G90Command[G90Commands, List[Any]]

Class for handling base G90 panel commands.

connection_lost(exc)

Invoked when connection is lost.

Return type:

None

connection_made(transport)

Invoked when connection is established.

Return type:

None

datagram_received(data, addr)

Invoked when datagram is received.

Return type:

None

decode_data(payload)

Decodes the command data from JSON string.

Return type:

List[Any]

encode_data(data)

Encodes the command data to JSON string.

Return type:

str

error_received(exc)

Invoked when error is received.

Return type:

None

property expects_response: bool

Indicates whether the command expects a response.

from_wire(data)

Parses the response from the alarm panel.

Return type:

List[Any]

property host: str

The hostname/IP address of the alarm panel.

pause_writing()

Called when the transport’s buffer goes over the high-water mark.

Pause and resume calls are paired – pause_writing() is called once when the buffer goes strictly over the high-water mark (even if subsequent writes increases the buffer size even more), and eventually resume_writing() is called once when the buffer size reaches the low-water mark.

Note that if the buffer size equals the high-water mark, pause_writing() is not called – it must go strictly over. Conversely, resume_writing() is called when the buffer size is equal or lower than the low-water mark. These end conditions are important to ensure that things go as expected when either mark is zero.

NOTE: This is the only Protocol callback that is not called through EventLoop.call_soon() – if it were, it would have no effect when it’s most needed (when the app keeps writing without yielding until pause_writing() is called).

property port: int

The port of the alarm panel.

async process()

Processes the command.

Return type:

Self

property result: List[Any]

The result of the command.

resume_writing()

Called when the transport’s buffer drains below the low-water mark.

See pause_writing() for details.

to_wire()

Returns the command in wire format.

Return type:

bytes

class pyg90alarm.G90PaginatedResult(host, port, code, start=1, end=None, **kwargs)

Bases: object

Processes paginated response from G90 corresponding panel commands.

async process()

Process paginated response yielding G90PaginatedResponse instance for each element.

Return type:

AsyncGenerator[G90PaginatedResponse, None]

class pyg90alarm.G90DeviceAlert(type, event_id, source, state, zone_name, device_id, unix_time, resv4, other)

Bases: object

Represents alert received from the device.

class pyg90alarm.G90Sensor(*args, parent, subindex, proto_idx, **kwargs)

Bases: G90BaseEntity

Interacts with sensor on G90 alarm panel.

Parameters:
  • args (Any) – Pass-through positional arguments for for interpreting protocol fields

  • parent (G90Alarm) – Instance of G90Alarm the sensor is associated with

  • subindex (int) – Index of the sensor within multi-channel devices (those having multiple nodes)

  • proto_idx (int) – Index of the sensor within list of sensors as retrieved from the alarm panel

  • kwargs (Any) – Pass-through keyword arguments for for interpreting protocol fields

property alert_mode: G90SensorAlertModes

Alert mode for the sensor.

Returns:

Alert mode

property definition: G90PeripheralDefinition | None

Returns the definition for the sensor.

Returns:

Sensor definition

async delete()

Deletes the sensor from the alarm panel.

Return type:

None

property door_open_when_arming_callback: G90CallbackList[Callable[[], None] | Callable[[], Coroutine[None, None, None]]]

Callback that is invoked when the sensor reports on open door condition when arming.

Returns:

Sensor’s door open when arming callback

See also

G90Alarm.sensor_callback for compatiblity notes

property enabled: bool

Indicates if the sensor is enabled, using :meth:get_user_flag instead is preferred.

Returns:

If sensor is enabled

property extra_data: Any

Extra data for the sensor, that can be used to store caller-specific information and will be carried by the sensor instance.

get_flag(flag)

Gets the user flag for the sensor.

Parameters:

flag (G90SensorUserFlags) – User flag to get

Return type:

bool

Returns:

User flag value

property index: int

Index (internal position) of the sensor in the alarm panel.

Returns:

Internal sensor position

property is_door_open_when_arming: bool

Indicates if the sensor reports on open door when arming.

The condition is cleared when panel is armed/disarmed next time.

property is_low_battery: bool

Indicates if the sensor is reporting low battery.

The condition is cleared when the sensor reports activity (i.e. is no longer low on battery as it is able to report the activity).

property is_tampered: bool

Indicates if the sensor has been tampered.

The condition is cleared when panel is armed/disarmed next time.

property is_unavailable: bool

Indicates if the sensor is unavailable (e.g. has been removed).

property is_wireless: bool

Indicates if the sensor is wireless.

property low_battery_callback: G90CallbackList[Callable[[], None] | Callable[[], Coroutine[None, None, None]]]

Callback that is invoked when the sensor reports on low battery condition.

Returns:

Sensor’s low battery callback

See also

G90Alarm.sensor_callback for compatiblity notes

property name: str

Sensor name, accounting for multi-channel entities (single protocol entity results in multiple G90Sensor instances).

Returns:

Sensor name

property node_count: int

Number of nodes (channels) for the sensor.

Returns:

Number of nodes

property occupancy: bool

Occupancy (occupied/not occupied, or triggered/not triggered) for the sensor.

Returns:

Sensor occupancy

property parent: G90Alarm

Parent instance of alarm panel class the sensor is associated with.

Returns:

Parent instance

property proto_idx: int

Index of the sensor within list of sensors as retrieved from the alarm panel.

Returns:

Index of sensor in list of sensors.

property protocol: G90PeripheralProtocols

Protocol type of the sensor.

Returns:

Protocol type

property protocol_data: G90SensorIncomingData

Protocol data of the sensor.

Returns:

Protocol data

property reserved: G90SensorReservedFlags

Reserved flags (read/write mode) for the sensor.

Returns:

Reserved flags

async set_alert_mode(value)

Sets the sensor alert mode.

Return type:

None

async set_enabled(value)

Sets the sensor enabled/disabled, using :meth:set_user_flag instead is preferred.

Parameters:

value (bool) – New the sensor should be enabled

Return type:

None

async set_flag(flag, value)

Sets the user flag for the sensor.

Parameters:
Return type:

None

async set_name(value)

Sets sensor name on the panel.

For multi-node entities the name is shared by all nodes on the panel; node suffixes are derived locally when the name is read.

Parameters:

value (str) – Name to set.

Return type:

None

async set_user_flag(value)

Sets user flags of the sensor, retained for compatibility - please use :meth:set_user_flags instead.

Return type:

None

async set_user_flags(value)

Sets user flags of the sensor.

Parameters:

value (G90SensorUserFlags) – User flags to set, values other than G90SensorUserFlags.USER_SETTABLE will be ignored and preserved from existing sensor flags.

Return type:

None

property state_callback: G90CallbackList[Callable[[bool], None] | Callable[[bool], Coroutine[None, None, None]]]

Callback that is invoked when the sensor changes its state.

Returns:

Sensor state callback

See also

G90Alarm.sensor_callback for compatiblity notes

property subindex: int

Index of the sensor within multi-node device.

Returns:

Index of sensor in multi-node device.

property subtype: int

Sub-type of the sensor.

Returns:

Sensor sub-type

property supports_enable_disable: bool

Indicates if disabling/enabling the sensor is supported.

Returns:

Support for enabling/disabling the sensor

property supports_updates: bool

Indicates if the sensor supports updates.

Returns:

Support for updates

property tamper_callback: G90CallbackList[Callable[[], None] | Callable[[], Coroutine[None, None, None]]]

Callback that is invoked when the sensor reports being tampered.

Returns:

Sensor’s tamper callback

See also

G90Alarm.sensor_callback for compatiblity notes

property type: G90PeripheralTypes

Type of the sensor.

Returns:

Sensor type

property type_name: str | None

Type of the sensor.

Returns:

Type

update(obj)

Updates sensor from another instance.

Parameters:

obj (G90Sensor) – Sensor instance to update from

Return type:

None

property user_flag: G90SensorUserFlags

User flags for the sensor, retained for compatibility - please use :attr:user_flags instead.

Returns:

User flags

property user_flags: G90SensorUserFlags

User flags for the sensor (disabled/enabled, arming type etc).

Returns:

User flags

enum pyg90alarm.G90PeripheralTypes(value)

Bases: IntEnum

Peripheral types.

Member Type:

int

Valid values are as follows:

DOOR = <G90PeripheralTypes.DOOR: 1>
GLASS = <G90PeripheralTypes.GLASS: 2>
GAS = <G90PeripheralTypes.GAS: 3>
SMOKE = <G90PeripheralTypes.SMOKE: 4>
SOS = <G90PeripheralTypes.SOS: 5>
VIB = <G90PeripheralTypes.VIB: 6>
WATER = <G90PeripheralTypes.WATER: 7>
INFRARED = <G90PeripheralTypes.INFRARED: 8>
IN_BEAM = <G90PeripheralTypes.IN_BEAM: 9>
REMOTE = <G90PeripheralTypes.REMOTE: 10>
RFID = <G90PeripheralTypes.RFID: 11>
DOORBELL = <G90PeripheralTypes.DOORBELL: 12>
BUTTONID = <G90PeripheralTypes.BUTTONID: 13>
WATCH = <G90PeripheralTypes.WATCH: 14>
FINGER_LOCK = <G90PeripheralTypes.FINGER_LOCK: 15>
SUBHOST = <G90PeripheralTypes.SUBHOST: 16>
REMOTE_2_4G = <G90PeripheralTypes.REMOTE_2_4G: 17>
GAS_VALVE = <G90PeripheralTypes.GAS_VALVE: 18>
CORD_SENSOR = <G90PeripheralTypes.CORD_SENSOR: 126>
SOCKET = <G90PeripheralTypes.SOCKET: 128>
SIREN = <G90PeripheralTypes.SIREN: 129>
CURTAIN = <G90PeripheralTypes.CURTAIN: 130>
SLIDINGWIN = <G90PeripheralTypes.SLIDINGWIN: 131>
AIRCON = <G90PeripheralTypes.AIRCON: 133>
TV = <G90PeripheralTypes.TV: 135>
TV_BOX = <G90PeripheralTypes.TV_BOX: 136>
SMART_SWITCH = <G90PeripheralTypes.SMART_SWITCH: 137>
NIGHTLIGHT = <G90PeripheralTypes.NIGHTLIGHT: 138>
SOCKET_2_4G = <G90PeripheralTypes.SOCKET_2_4G: 140>
SIREN_2_4G = <G90PeripheralTypes.SIREN_2_4G: 141>
SWITCH_2_4G = <G90PeripheralTypes.SWITCH_2_4G: 142>
TOUCH_SWITCH_2_4G = <G90PeripheralTypes.TOUCH_SWITCH_2_4G: 143>
CURTAIN_2_4G = <G90PeripheralTypes.CURTAIN_2_4G: 144>
IR_2_4G = <G90PeripheralTypes.IR_2_4G: 145>
CORD_DEV = <G90PeripheralTypes.CORD_DEV: 254>
UNKNOWN = <G90PeripheralTypes.UNKNOWN: 255>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90SensorAlertModes(value)

Bases: IntEnum

Dedicated alert modes for the sensors (subset of user flags).

Member Type:

int

Valid values are as follows:

ALERT_ALWAYS = <G90SensorAlertModes.ALERT_ALWAYS: 0>
ALERT_WHEN_AWAY = <G90SensorAlertModes.ALERT_WHEN_AWAY: 1>
ALERT_WHEN_AWAY_AND_HOME = <G90SensorAlertModes.ALERT_WHEN_AWAY_AND_HOME: 2>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

flag pyg90alarm.G90SensorUserFlags(value)

Bases: IntFlag

User flags of the sensor.

Member Type:

int

Valid values are as follows:

ENABLED = <G90SensorUserFlags.ENABLED: 1>
ARM_DELAY = <G90SensorUserFlags.ARM_DELAY: 2>
DETECT_DOOR = <G90SensorUserFlags.DETECT_DOOR: 4>
DOOR_CHIME = <G90SensorUserFlags.DOOR_CHIME: 8>
INDEPENDENT_ZONE = <G90SensorUserFlags.INDEPENDENT_ZONE: 16>
ALERT_WHEN_AWAY_AND_HOME = <G90SensorUserFlags.ALERT_WHEN_AWAY_AND_HOME: 32>
ALERT_WHEN_AWAY = <G90SensorUserFlags.ALERT_WHEN_AWAY: 64>
SUPPORTS_UPDATING_SUBTYPE = <G90SensorUserFlags.SUPPORTS_UPDATING_SUBTYPE: 512>

The Flag and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

flag pyg90alarm.G90AlertConfigFlags(value)

Bases: IntFlag

Alert configuration flags, used bitwise

Member Type:

int

Valid values are as follows:

AC_POWER_FAILURE = <G90AlertConfigFlags.AC_POWER_FAILURE: 1>
AC_POWER_RECOVER = <G90AlertConfigFlags.AC_POWER_RECOVER: 2>
ARM_DISARM = <G90AlertConfigFlags.ARM_DISARM: 4>
HOST_LOW_VOLTAGE = <G90AlertConfigFlags.HOST_LOW_VOLTAGE: 8>
SENSOR_LOW_VOLTAGE = <G90AlertConfigFlags.SENSOR_LOW_VOLTAGE: 16>
WIFI_AVAILABLE = <G90AlertConfigFlags.WIFI_AVAILABLE: 32>
WIFI_UNAVAILABLE = <G90AlertConfigFlags.WIFI_UNAVAILABLE: 64>
DOOR_OPEN = <G90AlertConfigFlags.DOOR_OPEN: 128>
DOOR_CLOSE = <G90AlertConfigFlags.DOOR_CLOSE: 256>
SMS_PUSH = <G90AlertConfigFlags.SMS_PUSH: 512>
UNKNOWN1 = <G90AlertConfigFlags.UNKNOWN1: 2048>
UNKNOWN2 = <G90AlertConfigFlags.UNKNOWN2: 8192>

The Flag and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

class pyg90alarm.G90Device(*args, parent, subindex, proto_idx, **kwargs)

Bases: G90Sensor

Interacts with device (relay) on G90 alarm panel.

property alert_mode: G90SensorAlertModes

Alert mode for the sensor.

Returns:

Alert mode

property definition: G90PeripheralDefinition | None

Returns the definition for the device.

Returns:

Device definition

async delete()

Deletes the device (relay) from the G90 alarm panel.

Return type:

None

property door_open_when_arming_callback: G90CallbackList[Callable[[], None] | Callable[[], Coroutine[None, None, None]]]

Callback that is invoked when the sensor reports on open door condition when arming.

Returns:

Sensor’s door open when arming callback

See also

G90Alarm.sensor_callback for compatiblity notes

property enabled: bool

Indicates if the sensor is enabled, using :meth:get_user_flag instead is preferred.

Returns:

If sensor is enabled

property extra_data: Any

Extra data for the sensor, that can be used to store caller-specific information and will be carried by the sensor instance.

get_flag(flag)

Gets the user flag for the sensor.

Parameters:

flag (G90SensorUserFlags) – User flag to get

Return type:

bool

Returns:

User flag value

property index: int

Index (internal position) of the sensor in the alarm panel.

Returns:

Internal sensor position

property is_door_open_when_arming: bool

Indicates if the sensor reports on open door when arming.

The condition is cleared when panel is armed/disarmed next time.

property is_low_battery: bool

Indicates if the sensor is reporting low battery.

The condition is cleared when the sensor reports activity (i.e. is no longer low on battery as it is able to report the activity).

property is_tampered: bool

Indicates if the sensor has been tampered.

The condition is cleared when panel is armed/disarmed next time.

property is_unavailable: bool

Indicates if the sensor is unavailable (e.g. has been removed).

property is_wireless: bool

Indicates if the sensor is wireless.

property low_battery_callback: G90CallbackList[Callable[[], None] | Callable[[], Coroutine[None, None, None]]]

Callback that is invoked when the sensor reports on low battery condition.

Returns:

Sensor’s low battery callback

See also

G90Alarm.sensor_callback for compatiblity notes

property name: str

Sensor name, accounting for multi-channel entities (single protocol entity results in multiple G90Sensor instances).

Returns:

Sensor name

property node_count: int

Number of nodes (channels) for the sensor.

Returns:

Number of nodes

property occupancy: bool

Occupancy (occupied/not occupied, or triggered/not triggered) for the sensor.

Returns:

Sensor occupancy

property parent: G90Alarm

Parent instance of alarm panel class the sensor is associated with.

Returns:

Parent instance

property proto_idx: int

Index of the sensor within list of sensors as retrieved from the alarm panel.

Returns:

Index of sensor in list of sensors.

property protocol: G90PeripheralProtocols

Protocol type of the sensor.

Returns:

Protocol type

property protocol_data: G90SensorIncomingData

Protocol data of the sensor.

Returns:

Protocol data

property reserved: G90SensorReservedFlags

Reserved flags (read/write mode) for the sensor.

Returns:

Reserved flags

async set_alert_mode(value)

Sets the sensor alert mode.

Return type:

None

async set_enabled(value)

Sets the sensor enabled/disabled, using :meth:set_user_flag instead is preferred.

Parameters:

value (bool) – New the sensor should be enabled

Return type:

None

async set_flag(flag, value)

Sets the user flag for the sensor.

Parameters:
Return type:

None

async set_name(value)

Sets sensor name on the panel.

For multi-node entities the name is shared by all nodes on the panel; node suffixes are derived locally when the name is read.

Parameters:

value (str) – Name to set.

Return type:

None

async set_user_flag(value)

Sets user flags of the sensor, retained for compatibility - please use :meth:set_user_flags instead.

Return type:

None

async set_user_flags(value)

Sets user flags of the sensor.

Parameters:

value (G90SensorUserFlags) – User flags to set, values other than G90SensorUserFlags.USER_SETTABLE will be ignored and preserved from existing sensor flags.

Return type:

None

property state_callback: G90CallbackList[Callable[[bool], None] | Callable[[bool], Coroutine[None, None, None]]]

Callback that is invoked when the sensor changes its state.

Returns:

Sensor state callback

See also

G90Alarm.sensor_callback for compatiblity notes

property subindex: int

Index of the sensor within multi-node device.

Returns:

Index of sensor in multi-node device.

property subtype: int

Sub-type of the sensor.

Returns:

Sensor sub-type

property supports_enable_disable: bool

Indicates if disabling/enabling the sensor is supported.

Returns:

Support for enabling/disabling the sensor

property supports_updates: bool

Indicates if the sensor supports updates.

Returns:

Support for updates

property tamper_callback: G90CallbackList[Callable[[], None] | Callable[[], Coroutine[None, None, None]]]

Callback that is invoked when the sensor reports being tampered.

Returns:

Sensor’s tamper callback

See also

G90Alarm.sensor_callback for compatiblity notes

async turn_off()

Turns off the device (relay)

Return type:

None

async turn_on()

Turns on the device (relay)

Return type:

None

property type: G90PeripheralTypes

Type of the sensor.

Returns:

Sensor type

property type_name: str | None

Type of the sensor.

Returns:

Type

update(obj)

Updates sensor from another instance.

Parameters:

obj (G90Sensor) – Sensor instance to update from

Return type:

None

property user_flag: G90SensorUserFlags

User flags for the sensor, retained for compatibility - please use :attr:user_flags instead.

Returns:

User flags

property user_flags: G90SensorUserFlags

User flags for the sensor (disabled/enabled, arming type etc).

Returns:

User flags

class pyg90alarm.G90HostInfo(host_guid, product_name, wifi_protocol_version, cloud_protocol_version, mcu_hw_version, wifi_hw_version, gsm_status_data, wifi_status_data, gprs_3g_active_data, wifi_setup_progress_data, battery_voltage, gsm_signal_level, wifi_signal_level)

Bases: object

Interprets data fields of GETHOSTINFO command.

property gprs_3g_active: bool

Indicates whether GPRS/3G is enabled.

property gsm_status: G90HostInfoGsmStatus

Translates the GSM module status received from the device into corresponding enum.

property wifi_setup_progress: G90HostInfoWifiSetupProgress

Translates the Wifi connection progress received from the device into corresponding enum.

property wifi_status: G90HostInfoWifiStatus

Translates the Wifi module status received from the device into corresponding enum.

enum pyg90alarm.G90HostInfoWifiStatus(value)

Bases: IntEnum

Defines possible values of Wifi module status.

Member Type:

int

Valid values are as follows:

POWERED_OFF = <G90HostInfoWifiStatus.POWERED_OFF: 0>
NOT_CONNECTED = <G90HostInfoWifiStatus.NOT_CONNECTED: 1>
SERVER_NOT_CONNECTED = <G90HostInfoWifiStatus.SERVER_NOT_CONNECTED: 2>
OPERATIONAL = <G90HostInfoWifiStatus.OPERATIONAL: 3>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90HostInfoGsmStatus(value)

Bases: IntEnum

Defines possible values of GSM module status.

Member Type:

int

Valid values are as follows:

POWERED_OFF = <G90HostInfoGsmStatus.POWERED_OFF: 0>
SIM_ABSENT = <G90HostInfoGsmStatus.SIM_ABSENT: 1>
NO_SIGNAL = <G90HostInfoGsmStatus.NO_SIGNAL: 2>
OPERATIONAL = <G90HostInfoGsmStatus.OPERATIONAL: 3>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

class pyg90alarm.G90HostStatus(host_status_data, host_phone_number, product_name, mcu_hw_version, wifi_hw_version)

Bases: object

Interprets data fields of GETHOSTSTATUS command.

property host_status: G90ArmDisarmTypes

Translates host status data to G90ArmDisarmTypes.

enum pyg90alarm.G90HostInfoWifiSetupProgress(value)

Bases: IntEnum

Defines possible values of Wifi connection progress.

Member Type:

int

Valid values are as follows:

IDLE = <G90HostInfoWifiSetupProgress.IDLE: 0>
CONNECTING = <G90HostInfoWifiSetupProgress.CONNECTING: 1>
OK = <G90HostInfoWifiSetupProgress.OK: 2>
WRONG_SSID = <G90HostInfoWifiSetupProgress.WRONG_SSID: 3>
WRONG_PASSWORD = <G90HostInfoWifiSetupProgress.WRONG_PASSWORD: 4>
CONNECTION_ERROR = <G90HostInfoWifiSetupProgress.CONNECTION_ERROR: 5>
WIFI_ERROR = <G90HostInfoWifiSetupProgress.WIFI_ERROR: 6>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90MessageTypes(value)

Bases: IntEnum

Defines message types (codes) from messages coming from the alarm panel.

Member Type:

int

Valid values are as follows:

NOTIFICATION = <G90MessageTypes.NOTIFICATION: 170>
ALERT = <G90MessageTypes.ALERT: 208>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90NotificationTypes(value)

Bases: IntEnum

Defines types of notifications sent by the alarm panel.

Member Type:

int

Valid values are as follows:

ARM_DISARM = <G90NotificationTypes.ARM_DISARM: 1>
SENSOR_CHANGE = <G90NotificationTypes.SENSOR_CHANGE: 4>
SENSOR_ACTIVITY = <G90NotificationTypes.SENSOR_ACTIVITY: 5>
DOOR_OPEN_WHEN_ARMING = <G90NotificationTypes.DOOR_OPEN_WHEN_ARMING: 6>
FIRMWARE_UPDATING = <G90NotificationTypes.FIRMWARE_UPDATING: 8>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90ArmDisarmTypes(value)

Bases: IntEnum

Defines arm/disarm states of the device, applicable both for setting device state and one the device sends in notification messages.

Member Type:

int

Valid values are as follows:

ARM_AWAY = <G90ArmDisarmTypes.ARM_AWAY: 1>
ARM_HOME = <G90ArmDisarmTypes.ARM_HOME: 2>
DISARM = <G90ArmDisarmTypes.DISARM: 3>
ALARMED = <G90ArmDisarmTypes.ALARMED: 4>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90AlertTypes(value)

Bases: IntEnum

Defines types of alerts sent by the alarm panel.

Member Type:

int

Valid values are as follows:

HOST_SOS = <G90AlertTypes.HOST_SOS: 1>
STATE_CHANGE = <G90AlertTypes.STATE_CHANGE: 2>
ALARM = <G90AlertTypes.ALARM: 3>
SENSOR_ACTIVITY = <G90AlertTypes.SENSOR_ACTIVITY: 4>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90AlertSources(value)

Bases: IntEnum

Defines possible sources of the alert sent by the panel.

Member Type:

int

Valid values are as follows:

DEVICE = <G90AlertSources.DEVICE: 0>
SENSOR = <G90AlertSources.SENSOR: 1>
TAMPER = <G90AlertSources.TAMPER: 3>
INFRARED = <G90AlertSources.INFRARED: 8>
REMOTE = <G90AlertSources.REMOTE: 10>
RFID = <G90AlertSources.RFID: 11>
DOORBELL = <G90AlertSources.DOORBELL: 12>
FINGERPRINT = <G90AlertSources.FINGERPRINT: 15>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90AlertStates(value)

Bases: IntEnum

Defines consolidated states of the alert sent by infrared and other sensors.

By a reason the infrared sensors use different codes for their alert states, this enum consolidates them into a single set for unification.

Member Type:

int

Valid values are as follows:

DOOR_CLOSE = <G90AlertStates.DOOR_CLOSE: 0>
DOOR_OPEN = <G90AlertStates.DOOR_OPEN: 1>
SOS = <G90AlertStates.SOS: 2>
TAMPER = <G90AlertStates.TAMPER: 3>
LOW_BATTERY = <G90AlertStates.LOW_BATTERY: 4>
MOTION_DETECTED = <G90AlertStates.MOTION_DETECTED: 5>
ALARM = <G90AlertStates.ALARM: 254>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90AlertStateChangeTypes(value)

Bases: IntEnum

Defines types of alert for device state changes.

Member Type:

int

Valid values are as follows:

AC_POWER_FAILURE = <G90AlertStateChangeTypes.AC_POWER_FAILURE: 1>
AC_POWER_RECOVER = <G90AlertStateChangeTypes.AC_POWER_RECOVER: 2>
DISARM = <G90AlertStateChangeTypes.DISARM: 3>
ARM_AWAY = <G90AlertStateChangeTypes.ARM_AWAY: 4>
ARM_HOME = <G90AlertStateChangeTypes.ARM_HOME: 5>
LOW_BATTERY = <G90AlertStateChangeTypes.LOW_BATTERY: 6>
WIFI_CONNECTED = <G90AlertStateChangeTypes.WIFI_CONNECTED: 7>
WIFI_DISCONNECTED = <G90AlertStateChangeTypes.WIFI_DISCONNECTED: 8>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90HistoryStates(value)

Bases: IntEnum

Defines possible states for history entities.

Member Type:

int

Valid values are as follows:

DOOR_CLOSE = <G90HistoryStates.DOOR_CLOSE: 1>
DOOR_OPEN = <G90HistoryStates.DOOR_OPEN: 2>
TAMPER = <G90HistoryStates.TAMPER: 3>
ALARM = <G90HistoryStates.ALARM: 4>
AC_POWER_FAILURE = <G90HistoryStates.AC_POWER_FAILURE: 5>
AC_POWER_RECOVER = <G90HistoryStates.AC_POWER_RECOVER: 6>
DISARM = <G90HistoryStates.DISARM: 7>
ARM_AWAY = <G90HistoryStates.ARM_AWAY: 8>
ARM_HOME = <G90HistoryStates.ARM_HOME: 9>
LOW_BATTERY = <G90HistoryStates.LOW_BATTERY: 10>
WIFI_CONNECTED = <G90HistoryStates.WIFI_CONNECTED: 11>
WIFI_DISCONNECTED = <G90HistoryStates.WIFI_DISCONNECTED: 12>
REMOTE_BUTTON_ARM_AWAY = <G90HistoryStates.REMOTE_BUTTON_ARM_AWAY: 13>
REMOTE_BUTTON_ARM_HOME = <G90HistoryStates.REMOTE_BUTTON_ARM_HOME: 14>
REMOTE_BUTTON_DISARM = <G90HistoryStates.REMOTE_BUTTON_DISARM: 15>
REMOTE_BUTTON_SOS = <G90HistoryStates.REMOTE_BUTTON_SOS: 16>
RFID_KEY_ARM_AWAY = <G90HistoryStates.RFID_KEY_ARM_AWAY: 17>
RFID_KEY_ARM_HOME = <G90HistoryStates.RFID_KEY_ARM_HOME: 18>
RFID_KEY_DISARM = <G90HistoryStates.RFID_KEY_DISARM: 19>
RFID_CARD_0 = <G90HistoryStates.RFID_CARD_0: 20>
RFID_CARD_1 = <G90HistoryStates.RFID_CARD_1: 21>
RFID_CARD_2 = <G90HistoryStates.RFID_CARD_2: 22>
RFID_CARD_3 = <G90HistoryStates.RFID_CARD_3: 23>
RFID_CARD_4 = <G90HistoryStates.RFID_CARD_4: 24>
MOTION_DETECTED = <G90HistoryStates.MOTION_DETECTED: 25>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

exception pyg90alarm.G90Error

Bases: Exception

Represents a generic exception raised by many package classes.

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception pyg90alarm.G90TimeoutError

Bases: TimeoutError, G90Error

Raised when particular package class to report an operation (typically device command) has timed out.

add_note(note, /)

Add a note to the exception

errno

POSIX exception code

filename

exception filename

filename2

second exception filename

strerror

exception strerror

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception pyg90alarm.G90RetryableError

Bases: G90Error

Raised for response or parsing conditions that trigger retries in G90BaseCommand and G90PaginatedCommand (e.g. wrong response code, truncated or extra data in paginated response).

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception pyg90alarm.G90CommandError

Bases: G90Error

Raised when a command to the alarm panel reports an error.

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception pyg90alarm.G90CommandFailure

Bases: G90Error

Raised when a command to the alarm panel reports failure.

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception pyg90alarm.G90EntityRegistrationError

Bases: G90Error

Raised when registering an entity to the alarm panel fails.

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception pyg90alarm.G90PeripheralDefinitionNotFound

Bases: G90Error

Raised when a peripheral definition is not found.

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

class pyg90alarm.G90SensorDefinitions

Bases: G90PeripheralDefinitionsBase

Sensor definitions for G90 devices, required when modifying them since writing a sensor to the device requires values not present on read.

classmethod definitions()

Gets all sensor definitions.

Return type:

list[G90PeripheralDefinition]

Returns:

List of sensor definitions.

classmethod get_by_id(id_type, id_subtype, protocol)

Gets peripheral definition by type, subtype and protocol.

Parameters:
Raises:

G90PeripheralDefinitionNotFound – If definition not found.

Return type:

G90PeripheralDefinition

classmethod get_by_name(name)

Gets peripheral definition by name.

Parameters:

name (str) – Peripheral name.

Raises:

G90PeripheralDefinitionNotFound – If definition not found.

Return type:

G90PeripheralDefinition

class pyg90alarm.G90DeviceDefinitions

Bases: G90PeripheralDefinitionsBase

Device definitions, required when modifying them since writing a device to the panel requires values not present on read.

classmethod definitions()

Gets all device definitions.

Return type:

list[G90PeripheralDefinition]

Returns:

List of device definitions.

classmethod get_by_id(id_type, id_subtype, protocol)

Gets peripheral definition by type, subtype and protocol.

Parameters:
Raises:

G90PeripheralDefinitionNotFound – If definition not found.

Return type:

G90PeripheralDefinition

classmethod get_by_name(name)

Gets peripheral definition by name.

Parameters:

name (str) – Peripheral name.

Raises:

G90PeripheralDefinitionNotFound – If definition not found.

Return type:

G90PeripheralDefinition

class pyg90alarm.G90HostConfig(alarm_siren_duration=<pyg90alarm.dataclass.validation.IntRangeValidator object>, arm_delay=<pyg90alarm.dataclass.validation.IntRangeValidator object>, alarm_delay=<pyg90alarm.dataclass.validation.IntRangeValidator object>, backlight_duration=<pyg90alarm.dataclass.validation.IntRangeValidator object>, _alarm_volume_level=<pyg90alarm.dataclass.validation.IntRangeValidator object>, _speech_volume_level=<pyg90alarm.dataclass.validation.IntRangeValidator object>, ring_duration=<pyg90alarm.dataclass.validation.IntRangeValidator object>, _speech_language=<pyg90alarm.dataclass.validation.IntRangeValidator object>, _key_tone_volume_level=<pyg90alarm.dataclass.validation.IntRangeValidator object>, timezone_offset_m=<pyg90alarm.dataclass.validation.IntRangeValidator object>, _ring_volume_level=<pyg90alarm.dataclass.load_save.ReadOnlyIfNotProvided object>)

Bases: DataclassLoadSave

Interprets data fields of GETHOSTCONFIG/SETHOSTCONFIG commands.

property alarm_volume_level: G90VolumeLevel

Returns the alarm volume level as an enum.

property key_tone_volume_level: G90VolumeLevel

Returns the key tone volume level as an enum.

async classmethod load(parent, force=False)

Create an instance with values loaded from the device.

Parameters:

force (bool) – If True, bypass policy cache (if any).

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

Returns:

An instance of the dataclass loaded from the device.

async classmethod load_uncached(parent)

Create an instance with values loaded from the device bypassing cache.

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

property ring_volume_level: G90VolumeLevel | None

Returns the ring volume level as an enum.

Returns:

Ring volume level, or None if the device does not have cellular module.

async save()

Save the current data to the device.

Refreshes the load policy cache (if any): the initial load(..., force=True) repopulates the policy’s entry for this parent with the newly loaded instance used for read-modify-write.

Return type:

None

serialize()

Returns the dataclass fields as a list.

Handles specific metadata for the fields. :seealso:`Metadata`.

Return type:

List[Any]

Returns:

Dataclass serialized as list.

property speech_language: G90SpeechLanguage

Returns the speech language as an enum.

property speech_volume_level: G90VolumeLevel

Returns the speech volume level as an enum.

enum pyg90alarm.G90VolumeLevel(value)

Bases: IntEnum

Supported volume levels.

Member Type:

int

Valid values are as follows:

MUTE = <G90VolumeLevel.MUTE: 0>
LOW = <G90VolumeLevel.LOW: 1>
HIGH = <G90VolumeLevel.HIGH: 2>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.G90SpeechLanguage(value)

Bases: IntEnum

Supported speech languages.

Member Type:

int

Valid values are as follows:

NONE = <G90SpeechLanguage.NONE: 0>
ENGLISH_FEMALE = <G90SpeechLanguage.ENGLISH_FEMALE: 1>
ENGLISH_MALE = <G90SpeechLanguage.ENGLISH_MALE: 2>
CHINESE_FEMALE = <G90SpeechLanguage.CHINESE_FEMALE: 3>
CHINESE_MALE = <G90SpeechLanguage.CHINESE_MALE: 4>
GERMAN_FEMALE = <G90SpeechLanguage.GERMAN_FEMALE: 5>
GERMAN_MALE = <G90SpeechLanguage.GERMAN_MALE: 6>
SPANISH_FEMALE = <G90SpeechLanguage.SPANISH_FEMALE: 7>
SPANISH_MALE = <G90SpeechLanguage.SPANISH_MALE: 8>
DUTCH_FEMALE = <G90SpeechLanguage.DUTCH_FEMALE: 9>
DUTCH_MALE = <G90SpeechLanguage.DUTCH_MALE: 10>
SWEDISH_FEMALE = <G90SpeechLanguage.SWEDISH_FEMALE: 11>
SWEDISH_MALE = <G90SpeechLanguage.SWEDISH_MALE: 12>
FRENCH_FEMALE = <G90SpeechLanguage.FRENCH_FEMALE: 13>
FRENCH_MALE = <G90SpeechLanguage.FRENCH_MALE: 14>
TURKISH_FEMALE = <G90SpeechLanguage.TURKISH_FEMALE: 15>
TURKISH_MALE = <G90SpeechLanguage.TURKISH_MALE: 16>
RUSSIAN_FEMALE = <G90SpeechLanguage.RUSSIAN_FEMALE: 17>
RUSSIAN_MALE = <G90SpeechLanguage.RUSSIAN_MALE: 18>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

class pyg90alarm.G90NetConfig(_ap_enabled=<pyg90alarm.dataclass.validation.IntRangeValidator object>, ap_password=<pyg90alarm.dataclass.validation.StringLengthValidator object>, _wifi_enabled=<pyg90alarm.dataclass.validation.IntRangeValidator object>, _gprs_enabled=<pyg90alarm.dataclass.validation.IntRangeValidator object>, apn_name=<pyg90alarm.dataclass.validation.StringLengthValidator object>, apn_user=<pyg90alarm.dataclass.validation.StringLengthValidator object>, apn_password=<pyg90alarm.dataclass.validation.StringLengthValidator object>, _apn_auth=<pyg90alarm.dataclass.validation.IntRangeValidator object>, gsm_operator=None)

Bases: DataclassLoadSave

Interprets data fields of GETAPINFO/SETAPINFO commands.

property ap_enabled: bool

Returns whether the access point is enabled.

property apn_auth: G90APNAuth

Returns the APN authentication method as an enum.

Some panels might send values outside of the defined enum range, presumably when SIM card is absent. In such cases, returns G90APNAuth.NONE.

No attempt is made to correct the invalid value in the underlying data field, since the panel is trusted - unless the value is modified and saved back to the device.

Returns:

APN authentication method, or G90APNAuth.NONE if the received value is invalid.

property gprs_enabled: bool

Returns whether GPRS is enabled.

async classmethod load(parent, force=False)

Create an instance with values loaded from the device.

Parameters:

force (bool) – If True, bypass policy cache (if any).

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

Returns:

An instance of the dataclass loaded from the device.

async classmethod load_uncached(parent)

Create an instance with values loaded from the device bypassing cache.

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

async save()

Save the current data to the device.

Refreshes the load policy cache (if any): the initial load(..., force=True) repopulates the policy’s entry for this parent with the newly loaded instance used for read-modify-write.

Return type:

None

serialize()

Returns the dataclass fields as a list.

Handles specific metadata for the fields. :seealso:`Metadata`.

Return type:

List[Any]

Returns:

Dataclass serialized as list.

property wifi_enabled: bool

Returns whether WiFi is enabled.

enum pyg90alarm.G90APNAuth(value)

Bases: IntEnum

Supported APN authentication methods.

Member Type:

int

Valid values are as follows:

NONE = <G90APNAuth.NONE: 0>
PAP = <G90APNAuth.PAP: 1>
CHAP = <G90APNAuth.CHAP: 2>
PAP_OR_CHAP = <G90APNAuth.PAP_OR_CHAP: 3>

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

class pyg90alarm.G90AlarmPhones(panel_password=<pyg90alarm.dataclass.validation.StringLengthValidator object>, panel_phone_number=<pyg90alarm.dataclass.validation.StringLengthValidator object>, phone_number_1=<pyg90alarm.dataclass.validation.StringLengthValidator object>, phone_number_2=<pyg90alarm.dataclass.validation.StringLengthValidator object>, phone_number_3=<pyg90alarm.dataclass.validation.StringLengthValidator object>, phone_number_4=<pyg90alarm.dataclass.validation.StringLengthValidator object>, phone_number_5=<pyg90alarm.dataclass.validation.StringLengthValidator object>, phone_number_6=<pyg90alarm.dataclass.validation.StringLengthValidator object>, sms_push_number_1=<pyg90alarm.dataclass.validation.StringLengthValidator object>, sms_push_number_2=<pyg90alarm.dataclass.validation.StringLengthValidator object>)

Bases: DataclassLoadSave

Interprets data fields of GETALMPHONE/SETALMPHONE commands.

async classmethod load(parent, force=False)

Create an instance with values loaded from the device.

Parameters:

force (bool) – If True, bypass policy cache (if any).

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

Returns:

An instance of the dataclass loaded from the device.

async classmethod load_uncached(parent)

Create an instance with values loaded from the device bypassing cache.

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

async save()

Save the current data to the device.

Refreshes the load policy cache (if any): the initial load(..., force=True) repopulates the policy’s entry for this parent with the newly loaded instance used for read-modify-write.

Return type:

None

serialize()

Returns the dataclass fields as a list.

Handles specific metadata for the fields. :seealso:`Metadata`.

Return type:

List[Any]

Returns:

Dataclass serialized as list.

class pyg90alarm.G90History(*args, **kwargs)

Bases: object

Represents a history entry from the alarm panel.

as_device_alert()

Returns the history entry represented as device alert structure, suitable for G90DeviceNotifications._handle_alert().

Return type:

G90DeviceAlert

property datetime: <property object at 0x765fecfa7e20>

Date/time of the history entry.

property sensor_idx: int | None

ID of the sensor related to the history entry, might be empty if none associated.

property sensor_name: str | None

Name of the sensor related to the history entry, might be empty if none associated.

property source: G90AlertSources | None

Source of the history entry.

property state: G90HistoryStates | None

State for the history entry.

property type: G90AlertTypes | None

Type of the history entry.

class pyg90alarm.G90SiaConfig(host=<pyg90alarm.dataclass.validation.StringLengthValidator object>, port=<pyg90alarm.dataclass.validation.IntRangeValidator object>, account=<pyg90alarm.dataclass.validation.StringLengthValidator object>, receiver=<pyg90alarm.dataclass.validation.StringLengthValidator object>, prefix=<pyg90alarm.dataclass.validation.StringLengthValidator object>, aes_key=<pyg90alarm.dataclass.validation.StringLengthValidator object>, _encryption=<pyg90alarm.dataclass.validation.IntRangeValidator object>, _enabled=<pyg90alarm.dataclass.validation.IntRangeValidator object>, event_flags=<pyg90alarm.dataclass.validation.StringLengthValidator object>, heartbeat_interval=<pyg90alarm.dataclass.load_save.ReadOnlyIfNotProvided object>)

Bases: DataclassLoadSave

Interprets data fields of GETSIA/SETSIA commands.

property enabled: bool

Returns whether SIA Internet reporting is enabled.

property encryption: bool

Returns whether SIA encryption is enabled.

async classmethod load(parent, force=False)

Create an instance with values loaded from the device.

Parameters:

force (bool) – If True, bypass policy cache (if any).

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

Returns:

An instance of the dataclass loaded from the device.

async classmethod load_uncached(parent)

Create an instance with values loaded from the device bypassing cache.

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

async save()

Save the current data to the device.

Refreshes the load policy cache (if any): the initial load(..., force=True) repopulates the policy’s entry for this parent with the newly loaded instance used for read-modify-write.

Return type:

None

serialize()

Returns the dataclass fields as a list suitable for SETSIA.

The event_flags element is always set to FFFFFFFF regardless of the current value, as expected by the panel.

Return type:

list[Any]

class pyg90alarm.G90CidConfig(phone1=<pyg90alarm.dataclass.validation.StringLengthValidator object>, phone2=<pyg90alarm.dataclass.validation.StringLengthValidator object>, user=<pyg90alarm.dataclass.validation.StringLengthValidator object>, _enabled=<pyg90alarm.dataclass.validation.IntRangeValidator object>, event_flags=<pyg90alarm.dataclass.validation.StringLengthValidator object>)

Bases: DataclassLoadSave

Interprets data fields of GETCID/SETCID commands.

property enabled: bool

Returns whether CID phone reporting is enabled.

async classmethod load(parent, force=False)

Create an instance with values loaded from the device.

Parameters:

force (bool) – If True, bypass policy cache (if any).

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

Returns:

An instance of the dataclass loaded from the device.

async classmethod load_uncached(parent)

Create an instance with values loaded from the device bypassing cache.

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

async save()

Save the current data to the device.

Refreshes the load policy cache (if any): the initial load(..., force=True) repopulates the policy’s entry for this parent with the newly loaded instance used for read-modify-write.

Return type:

None

serialize()

Returns the dataclass fields as a list suitable for SETCID.

The event_flags element is always set to FFFF regardless of the current value, as expected by the panel.

Return type:

list[Any]

pyg90alarm.get_field_validation_constraints(dataclass_type, field_name, expected_type=None)

Retrieve validation constraints for a specific dataclass field.

Parameters:
  • dataclass_type (DataclassInstance | type[DataclassInstance]) – The dataclass type or instance to inspect.

  • field_name (str) – The name of the field to get constraints for.

  • expected_type (Optional[type]) – Expected type of the field to determine which constraints to retrieve.

Return type:

Any

Returns:

Validation constraints container, or ValidationConstraintsAbsent if none found. The latter is to avoid returning None and free callers from having to check for it.

Example:

constraints = get_field_validation_constraints(Config, ‘count’, int) # Returns: object with constraints.min_value, constraints.max_value

class pyg90alarm.DataclassLoadSave

Bases: object

Base class for loading/saving dataclasses to a device.

There are multiple ways to implement the functionality:
  • Encapsulate the dataclass inside another class that handles loading/saving and exposes dataclass fields as properties. The latter part gets complex as properties need to be asynchronous, as well as added dynamically at runtime to improve maintainability.

  • Inherit from this class, which provides load and save methods on top of standard dataclasses. This is believed to be more concise and easier to understand.

Implementing classes must define LOAD_COMMAND and SAVE_COMMAND class variables to specify which commands to use for loading and saving data.

Example usage:

@dataclass class G90ExampleConfig(DataclassLoadSave):

LOAD_COMMAND = G90Commands.GETEXAMPLECONFIG SAVE_COMMAND = G90Commands.SETEXAMPLECONFIG field1: int field2: str

# Loading data config = await G90ExampleConfig.load(G90_alarm_instance) print(config.field1, config.field2)

# Modifying and saving data config.field1 = 42 await config.save()

async classmethod load(parent, force=False)

Create an instance with values loaded from the device.

Parameters:

force (bool) – If True, bypass policy cache (if any).

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

Returns:

An instance of the dataclass loaded from the device.

async classmethod load_uncached(parent)

Create an instance with values loaded from the device bypassing cache.

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

async save()

Save the current data to the device.

Refreshes the load policy cache (if any): the initial load(..., force=True) repopulates the policy’s entry for this parent with the newly loaded instance used for read-modify-write.

Return type:

None

serialize()

Returns the dataclass fields as a list.

Handles specific metadata for the fields. :seealso:`Metadata`.

Return type:

List[Any]

Returns:

Dataclass serialized as list.

Modules

alarm

Provides interface to G90 alarm panel.

callback

Implements callbacks.

cloud

Cloud communication implementation for G90 alarm systems.

const

Definies different constants for G90 alarm panel.

dataclass

definitions

Contains various definitions for G90 devices (sensors etc.)

entities

Implements various protocol entities for G90 alarm panel.

event_mapping

Defines mapping of various events.

exceptions

Exceptions specific to G90-based alarm systems.

local

notifications