pyg90alarm.local.host_config

Protocol entity for G90 alarm panel config.

Classes

G90HostConfig([alarm_siren_duration, ...])

Interprets data fields of GETHOSTCONFIG/SETHOSTCONFIG commands.

enum pyg90alarm.local.host_config.G90SpeechLanguage(value)

Bases: IntEnum

Supported speech languages.

Member Type:

int

Valid values are as follows:

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

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

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

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

Also known as the population count.

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

Return an array of bytes representing an integer.

length

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

byteorder

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

signed

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

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

Return the integer represented by the given array of bytes.

bytes

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

byteorder

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

signed

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

as_integer_ratio()

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

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

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

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

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

enum pyg90alarm.local.host_config.G90VolumeLevel(value)

Bases: IntEnum

Supported volume levels.

Member Type:

int

Valid values are as follows:

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

The Enum and its members also have the following methods:

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

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

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

Also known as the population count.

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

Return an array of bytes representing an integer.

length

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

byteorder

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

signed

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

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

Return the integer represented by the given array of bytes.

bytes

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

byteorder

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

signed

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

as_integer_ratio()

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

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

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

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

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

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

Bases: DataclassLoadSave

Interprets data fields of GETHOSTCONFIG/SETHOSTCONFIG commands.

property speech_language: G90SpeechLanguage

Returns the speech language as an enum.

property alarm_volume_level: G90VolumeLevel

Returns the alarm volume level as an enum.

property speech_volume_level: G90VolumeLevel

Returns the speech volume level as an enum.

async classmethod load(parent, force=False)

Create an instance with values loaded from the device.

Parameters:

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

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

Returns:

An instance of the dataclass loaded from the device.

async classmethod load_uncached(parent)

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

Return type:

TypeVar(DataclassLoadSaveT, bound= DataclassLoadSave)

async save()

Save the current data to the device.

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

Return type:

None

serialize()

Returns the dataclass fields as a list.

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

Return type:

List[Any]

Returns:

Dataclass serialized as list.

property key_tone_volume_level: G90VolumeLevel

Returns the key tone volume level as an enum.

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.