pyg90alarm
Python package to control G90-based alarm systems.
- class pyg90alarm.G90Alarm(host, port=12368, reset_occupancy_interval=3.0)
Bases:
G90NotificationProtocolAllows 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 customizedreset_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_callbackfor 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:
- Returns:
Alarm panel phone numbers
- property alert_config: G90AlertConfig
Provides alert configuration object.
- Returns:
Alert configuration object
- 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_callbackfor 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:
- Returns:
CID phone reporting configuration
- async command(code, data=None)
Invokes a command against the alarm panel.
- 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_callbackfor 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 classmethod discover()
Initiates discovering devices available in the same network segment, by using global broadcast address as the destination.
- Return type:
- 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_callbackfor 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_callbackfor compatibility notes
- async find_device(idx, name, exclude_unavailable=True)
Finds device by index and name.
- async find_sensor(idx, name, exclude_unavailable=True)
Finds sensor by index and name.
- async get_alert_config()
Provides alert configuration flags, retained for compatibility - using
alert_configandG90AlertConfigis preferred.- Return type:
- 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.
- async get_host_info()
Provides the device information (for example hardware versions, signal levels etc.).
- Return type:
- Returns:
Device information
- async get_host_status()
Provides the device status (for example, armed or disarmed, configured phone number, product name etc.).
- Return type:
- Returns:
Device information
- async get_sensors()
Provides list of sensors configured in the device, updating them from panel on each call.
- 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:
- 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:
- async history(start=1, count=1)
Retrieves event history from the device.
- Parameters:
- Return type:
- 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:
- 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:
- 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_callbackfor 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:
- 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:
- 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.
- 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:
- 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.
- 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:
- 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.
- 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.
- 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 alarmzone_name (
str) – Sensor namebutton (
G90RemoteButtonStates) – The button pressed
- Return type:
- 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 namestate (
G90RFIDKeypadStates) – The RFID keypad state
- Return type:
- 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 ofsensorsarrayname (
str) – The name of the sensor, along with the idx parameter it is used to look the sensor up from thesensorslistoccupancy (
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:
- 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.
- 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.
- 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.
- 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 codestart (
int) – Starting record position (one-based)
- Return type:
- 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:
- async register_device(definition_name, name=None, timeout=30)
Registers device (relay, switch) with the panel.
- Parameters:
- Return type:
- Returns:
Device instance
- async register_sensor(definition_name, name=None, timeout=30)
Registers the sensor with the panel.
- Parameters:
- Return type:
- 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_callbackfor 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_callbackfor 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
G90CallbackListinstance 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_callbackfor 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_configandG90AlertConfigis preferred.- Return type:
- 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 packagecloud_port (
int) – Port number of the server to receive cloud protocol notifications, should be reachable from the panel
- Return type:
- 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:
- 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_callbackfor 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.
- 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:
- 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:
- 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 panelcloud_port (
int) – The cloud server port to connect to, should be reachable from the panelcloud_local_ip (
str) – Local IP address to bind cloud notifications listener tocloud_local_port (
int) – Local port to bind cloud notifications listener to, should match cloud_port above unless network setup dictates otherwiseupstream_host (
str|None) – Optional upstream host to connect to cloud server throughupstream_port (
int|None) – Optional upstream port to connect to cloud server throughkeep_single_connection (
bool) – If enabled, keeps a single connection to the upstream cloud server for both sending and receiving data
- Return type:
- 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:
- property user_data_crc: G90UserDataCRC
Property over new
get_user_data_crc()method, retained for compatibility.
- class pyg90alarm.G90BaseCommand(*args, **kwargs)
Bases:
G90Command[G90Commands,List[Any]]Class for handling base G90 panel commands.
- 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).
- async process()
Processes the command.
- Return type:
Self
- resume_writing()
Called when the transport’s buffer drains below the low-water mark.
See pause_writing() for details.
- class pyg90alarm.G90PaginatedResult(host, port, code, start=1, end=None, **kwargs)
Bases:
objectProcesses paginated response from G90 corresponding panel commands.
- async process()
Process paginated response yielding
G90PaginatedResponseinstance for each element.- Return type:
- class pyg90alarm.G90DeviceAlert(type, event_id, source, state, zone_name, device_id, unix_time, resv4, other)
Bases:
objectRepresents alert received from the device.
- class pyg90alarm.G90Sensor(*args, parent, subindex, proto_idx, **kwargs)
Bases:
G90BaseEntityInteracts with sensor on G90 alarm panel.
- Parameters:
args (
Any) – Pass-through positional arguments for for interpreting protocol fieldsparent (
G90Alarm) – Instance ofG90Alarmthe sensor is associated withsubindex (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
- 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_callbackfor 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:
- 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.
Indicates if the sensor is unavailable (e.g. has been removed).
- 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_callbackfor compatiblity notes
- property name: str
Sensor name, accounting for multi-channel entities (single protocol entity results in multiple
G90Sensorinstances).- Returns:
Sensor name
- 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_enabled(value)
Sets the sensor enabled/disabled, using :meth:set_user_flag instead is preferred.
- async set_flag(flag, value)
Sets the user flag for the sensor.
- Parameters:
flag (
G90SensorUserFlags) – User flag to setvalue (
bool) – New value for the user flag
- Return type:
- 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
nameis read.
- async set_user_flag(value)
Sets user flags of the sensor, retained for compatibility - please use :meth:set_user_flags instead.
- Return type:
- async set_user_flags(value)
Sets user flags of the sensor.
- Parameters:
value (
G90SensorUserFlags) – User flags to set, values other thanG90SensorUserFlags.USER_SETTABLEwill be ignored and preserved from existing sensor flags.- Return type:
- 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_callbackfor compatiblity notes
- property subindex: int
Index of the sensor within multi-node device.
- Returns:
Index of sensor in multi-node device.
- 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_callbackfor compatiblity notes
- property type: G90PeripheralTypes
Type of the sensor.
- Returns:
Sensor type
- update(obj)
Updates sensor from another instance.
- 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:
IntEnumPeripheral types.
- Member Type:
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
Enumand 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:
IntEnumDedicated alert modes for the sensors (subset of user flags).
- Member Type:
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
Enumand 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:
IntFlagUser flags of the sensor.
- Member Type:
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
Flagand 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:
IntFlagAlert configuration flags, used bitwise
- Member Type:
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
Flagand 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:
G90SensorInteracts 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
- 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_callbackfor 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:
- 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.
Indicates if the sensor is unavailable (e.g. has been removed).
- 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_callbackfor compatiblity notes
- property name: str
Sensor name, accounting for multi-channel entities (single protocol entity results in multiple
G90Sensorinstances).- Returns:
Sensor name
- 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_enabled(value)
Sets the sensor enabled/disabled, using :meth:set_user_flag instead is preferred.
- async set_flag(flag, value)
Sets the user flag for the sensor.
- Parameters:
flag (
G90SensorUserFlags) – User flag to setvalue (
bool) – New value for the user flag
- Return type:
- 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
nameis read.
- async set_user_flag(value)
Sets user flags of the sensor, retained for compatibility - please use :meth:set_user_flags instead.
- Return type:
- async set_user_flags(value)
Sets user flags of the sensor.
- Parameters:
value (
G90SensorUserFlags) – User flags to set, values other thanG90SensorUserFlags.USER_SETTABLEwill be ignored and preserved from existing sensor flags.- Return type:
- 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_callbackfor compatiblity notes
- property subindex: int
Index of the sensor within multi-node device.
- Returns:
Index of sensor in multi-node device.
- 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_callbackfor compatiblity notes
- property type: G90PeripheralTypes
Type of the sensor.
- Returns:
Sensor type
- update(obj)
Updates sensor from another instance.
- 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:
objectInterprets data fields of GETHOSTINFO command.
- 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:
IntEnumDefines possible values of Wifi module status.
- Member Type:
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
Enumand 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:
IntEnumDefines possible values of GSM module status.
- Member Type:
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
Enumand 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:
objectInterprets data fields of GETHOSTSTATUS command.
- property host_status: G90ArmDisarmTypes
Translates host status data to G90ArmDisarmTypes.
- enum pyg90alarm.G90HostInfoWifiSetupProgress(value)
Bases:
IntEnumDefines possible values of Wifi connection progress.
- Member Type:
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
Enumand 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:
IntEnumDefines message types (codes) from messages coming from the alarm panel.
- Member Type:
Valid values are as follows:
- NOTIFICATION = <G90MessageTypes.NOTIFICATION: 170>
- ALERT = <G90MessageTypes.ALERT: 208>
The
Enumand 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:
IntEnumDefines types of notifications sent by the alarm panel.
- Member Type:
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
Enumand 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:
IntEnumDefines arm/disarm states of the device, applicable both for setting device state and one the device sends in notification messages.
- Member Type:
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
Enumand 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:
IntEnumDefines types of alerts sent by the alarm panel.
- Member Type:
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
Enumand 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:
IntEnumDefines possible sources of the alert sent by the panel.
- Member Type:
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
Enumand 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:
IntEnumDefines 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:
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
Enumand 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:
IntEnumDefines types of alert for device state changes.
- Member Type:
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
Enumand 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:
IntEnumDefines possible states for history entities.
- Member Type:
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
Enumand 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:
ExceptionRepresents 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,G90ErrorRaised 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:
G90ErrorRaised 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:
G90ErrorRaised 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:
G90ErrorRaised 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:
G90ErrorRaised 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:
G90ErrorRaised 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:
G90PeripheralDefinitionsBaseSensor 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:
- Returns:
List of sensor definitions.
- classmethod get_by_id(id_type, id_subtype, protocol)
Gets peripheral definition by type, subtype and protocol.
- Parameters:
id_type (
G90PeripheralTypes) – Peripheral type.id_subtype (
int) – Peripheral subtype.protocol (
G90PeripheralProtocols) – Peripheral protocol.
- Raises:
G90PeripheralDefinitionNotFound – If definition not found.
- Return type:
- classmethod get_by_name(name)
Gets peripheral definition by name.
- Parameters:
name (
str) – Peripheral name.- Raises:
G90PeripheralDefinitionNotFound – If definition not found.
- Return type:
- class pyg90alarm.G90DeviceDefinitions
Bases:
G90PeripheralDefinitionsBaseDevice 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:
- Returns:
List of device definitions.
- classmethod get_by_id(id_type, id_subtype, protocol)
Gets peripheral definition by type, subtype and protocol.
- Parameters:
id_type (
G90PeripheralTypes) – Peripheral type.id_subtype (
int) – Peripheral subtype.protocol (
G90PeripheralProtocols) – Peripheral protocol.
- Raises:
G90PeripheralDefinitionNotFound – If definition not found.
- Return type:
- classmethod get_by_name(name)
Gets peripheral definition by name.
- Parameters:
name (
str) – Peripheral name.- Raises:
G90PeripheralDefinitionNotFound – If definition not found.
- Return type:
- 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:
DataclassLoadSaveInterprets 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.
- 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:
- serialize()
Returns the dataclass fields as a list.
Handles specific metadata for the fields. :seealso:`Metadata`.
- 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:
IntEnumSupported volume levels.
- Member Type:
Valid values are as follows:
- MUTE = <G90VolumeLevel.MUTE: 0>
- LOW = <G90VolumeLevel.LOW: 1>
- HIGH = <G90VolumeLevel.HIGH: 2>
The
Enumand 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:
IntEnumSupported speech languages.
- Member Type:
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
Enumand 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:
DataclassLoadSaveInterprets data fields of GETAPINFO/SETAPINFO commands.
- 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.
- async classmethod load(parent, force=False)
Create an instance with values 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:
- serialize()
Returns the dataclass fields as a list.
Handles specific metadata for the fields. :seealso:`Metadata`.
- enum pyg90alarm.G90APNAuth(value)
Bases:
IntEnumSupported APN authentication methods.
- Member Type:
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
Enumand 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:
DataclassLoadSaveInterprets data fields of GETALMPHONE/SETALMPHONE commands.
- async classmethod load(parent, force=False)
Create an instance with values 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:
- serialize()
Returns the dataclass fields as a list.
Handles specific metadata for the fields. :seealso:`Metadata`.
- class pyg90alarm.G90History(*args, **kwargs)
Bases:
objectRepresents 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:
- 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:
DataclassLoadSaveInterprets data fields of GETSIA/SETSIA commands.
- async classmethod load(parent, force=False)
Create an instance with values 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:
- 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:
DataclassLoadSaveInterprets data fields of GETCID/SETCID commands.
- async classmethod load(parent, force=False)
Create an instance with values 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:
- 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:
objectBase 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.
- 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:
- serialize()
Returns the dataclass fields as a list.
Handles specific metadata for the fields. :seealso:`Metadata`.
Modules
Provides interface to G90 alarm panel. |
|
Implements callbacks. |
|
Cloud communication implementation for G90 alarm systems. |
|
Definies different constants for G90 alarm panel. |
|
Contains various definitions for G90 devices (sensors etc.) |
|
Implements various protocol entities for G90 alarm panel. |
|
Defines mapping of various events. |
|
Exceptions specific to G90-based alarm systems. |
|