pyg90alarm 2.5.1__tar.gz → 2.5.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/PKG-INFO +1 -1
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/host_config.py +1 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/net_config.py +16 -2
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/PKG-INFO +1 -1
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_host_config.py +32 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_net_config.py +95 -1
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/.github/CODEOWNERS +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/.github/dependabot.yml +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/.github/workflows/main.yml +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/.gitignore +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/.pylintrc +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/.readthedocs.yaml +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/LICENSE +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/MANIFEST.in +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/README.rst +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/docs/.DS_Store +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/docs/.gitignore +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/docs/api-docs.rst +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/docs/cloud-protocol.rst +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/docs/conf.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/docs/index.rst +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/docs/local-protocol.rst +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/docs/requirements.txt +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/pyproject.toml +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/setup.cfg +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/setup.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/sonar-project.properties +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/__init__.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/alarm.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/callback.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/__init__.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/const.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/messages.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/notifications.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/protocol.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/const.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/dataclass/__init__.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/dataclass/load_save.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/dataclass/validation.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/definitions/__init__.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/definitions/base.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/definitions/devices.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/definitions/sensors.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/__init__.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/base_entity.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/base_list.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/device.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/device_list.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/sensor.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/sensor_list.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/event_mapping.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/exceptions.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/__init__.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/alarm_phones.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/alert_config.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/base_cmd.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/config.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/discovery.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/history.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/host_info.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/host_status.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/notifications.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/paginated_cmd.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/paginated_result.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/targeted_discovery.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/local/user_data_crc.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/notifications/__init__.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/notifications/base.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/notifications/protocol.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm/py.typed +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/SOURCES.txt +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/dependency_links.txt +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/requires.txt +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/top_level.txt +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/__init__.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/conftest.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/device_mock.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_alarm.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_alarm_phones.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_base_commands.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_cloud_notifications.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_config.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_devices.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_discovery.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_history.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_local_notifications.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_paginated_commands.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/test_sensor.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_dataclass_load_save.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_dataclass_load_save_descriptor.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_dataclass_load_save_serialize.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_validation.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/unit/entities/test_base_list.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/unit/test_exceptions.py +0 -0
- {pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tox.ini +0 -0
|
@@ -73,7 +73,7 @@ class G90NetConfig(DataclassLoadSave):
|
|
|
73
73
|
# Access Point Name (APN) for GPRS connection, as provided by the cellular
|
|
74
74
|
# operator
|
|
75
75
|
apn_name: str = validated_string_field(
|
|
76
|
-
min_length=
|
|
76
|
+
min_length=0, max_length=100, trust_initial_value=True
|
|
77
77
|
)
|
|
78
78
|
# User name for APN authentication, as provided by the cellular operator
|
|
79
79
|
apn_user: str = validated_string_field(
|
|
@@ -132,8 +132,22 @@ class G90NetConfig(DataclassLoadSave):
|
|
|
132
132
|
def apn_auth(self) -> G90APNAuth:
|
|
133
133
|
"""
|
|
134
134
|
Returns the APN authentication method as an enum.
|
|
135
|
+
|
|
136
|
+
Some panels might send values outside of the defined enum range,
|
|
137
|
+
presumably when SIM card is absent. In such cases, returns
|
|
138
|
+
`G90APNAuth.NONE`.
|
|
139
|
+
|
|
140
|
+
No attempt is made to correct the invalid value in the underlying
|
|
141
|
+
data field, since the panel is trusted - unless the value is modified
|
|
142
|
+
and saved back to the device.
|
|
143
|
+
|
|
144
|
+
:return: APN authentication method, or G90APNAuth.NONE if the received
|
|
145
|
+
value is invalid.
|
|
135
146
|
"""
|
|
136
|
-
|
|
147
|
+
try:
|
|
148
|
+
return G90APNAuth(self._apn_auth)
|
|
149
|
+
except ValueError:
|
|
150
|
+
return G90APNAuth.NONE
|
|
137
151
|
|
|
138
152
|
@apn_auth.setter
|
|
139
153
|
def apn_auth(self, value: G90APNAuth) -> None:
|
|
@@ -164,3 +164,35 @@ async def test_host_config_constraints(
|
|
|
164
164
|
# Test setting valid value
|
|
165
165
|
setattr(cfg, field_name, valid_value)
|
|
166
166
|
assert getattr(cfg, field_name) == valid_value
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
@pytest.mark.g90device(sent_data=[
|
|
170
|
+
b'ISTART[106,'
|
|
171
|
+
b'[900,0,0,1,2,2,60,0,0,60,2]'
|
|
172
|
+
b']IEND\0',
|
|
173
|
+
b'ISTARTIEND\0'
|
|
174
|
+
])
|
|
175
|
+
async def test_host_config_speech_language_zero(
|
|
176
|
+
mock_device: DeviceMock
|
|
177
|
+
) -> None:
|
|
178
|
+
"""
|
|
179
|
+
Tests for handling host configuration with speech language set to zero.
|
|
180
|
+
"""
|
|
181
|
+
g90 = G90Alarm(host=mock_device.host, port=mock_device.port)
|
|
182
|
+
|
|
183
|
+
# Retrieve configuration
|
|
184
|
+
cfg = await g90.host_config()
|
|
185
|
+
assert isinstance(cfg, G90HostConfig)
|
|
186
|
+
|
|
187
|
+
# Verify retrieved values
|
|
188
|
+
assert cfg.speech_language == G90SpeechLanguage.NONE
|
|
189
|
+
|
|
190
|
+
# Verify zero value is allowed to be sent back to the panel
|
|
191
|
+
await cfg.save()
|
|
192
|
+
|
|
193
|
+
assert await mock_device.recv_data == [
|
|
194
|
+
b'ISTART[106,106,""]IEND\0',
|
|
195
|
+
b'ISTART[107,107,[107,'
|
|
196
|
+
b'[900,0,0,1,2,2,60,0,0,60,2]'
|
|
197
|
+
b']]IEND\0'
|
|
198
|
+
]
|
|
@@ -80,7 +80,7 @@ async def test_net_config(
|
|
|
80
80
|
@pytest.mark.parametrize(
|
|
81
81
|
'field_name,invalid_value_low,invalid_value_high,valid_value', [
|
|
82
82
|
pytest.param(
|
|
83
|
-
'apn_name',
|
|
83
|
+
'apn_name', None, 'a' * 101, 'valid.apn.net',
|
|
84
84
|
id='apn_name'
|
|
85
85
|
),
|
|
86
86
|
pytest.param(
|
|
@@ -151,3 +151,97 @@ async def test_net_config_constraints(
|
|
|
151
151
|
# Test setting valid value
|
|
152
152
|
setattr(cfg, field_name, valid_value)
|
|
153
153
|
assert getattr(cfg, field_name) == valid_value
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
@pytest.mark.g90device(sent_data=[
|
|
157
|
+
b'ISTART[212,'
|
|
158
|
+
b'[0,"123456789",1,1,"","user","pwd",3,"54321"]'
|
|
159
|
+
b']IEND\0',
|
|
160
|
+
b'ISTARTIEND\0'
|
|
161
|
+
])
|
|
162
|
+
async def test_net_config_apn_name_empty(
|
|
163
|
+
mock_device: DeviceMock, caplog: pytest.LogCaptureFixture
|
|
164
|
+
) -> None:
|
|
165
|
+
"""
|
|
166
|
+
Tests for handling network configuration with empty APN name.
|
|
167
|
+
"""
|
|
168
|
+
g90 = G90Alarm(host=mock_device.host, port=mock_device.port)
|
|
169
|
+
|
|
170
|
+
# Retrieve configuration
|
|
171
|
+
cfg = await g90.net_config()
|
|
172
|
+
assert isinstance(cfg, G90NetConfig)
|
|
173
|
+
|
|
174
|
+
# Verify retrieved values
|
|
175
|
+
assert cfg.apn_name == ''
|
|
176
|
+
|
|
177
|
+
# Ensure that no validation error was logged for empty APN name, the value
|
|
178
|
+
# of the field as received from the panel is trusted, so no exception will
|
|
179
|
+
# be raised only error logged
|
|
180
|
+
assert (
|
|
181
|
+
'apn_name: Validation failed during initialization for trusted value'
|
|
182
|
+
) not in ''.join(caplog.messages)
|
|
183
|
+
|
|
184
|
+
# Verify empty APN name is allowed to be sent back to the panel
|
|
185
|
+
await cfg.save()
|
|
186
|
+
|
|
187
|
+
assert await mock_device.recv_data == [
|
|
188
|
+
b'ISTART[212,212,""]IEND\0',
|
|
189
|
+
b'ISTART[213,213,[213,'
|
|
190
|
+
b'[0,"123456789",1,1,"","user","pwd",3]'
|
|
191
|
+
b']]IEND\0'
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@pytest.mark.parametrize('new_apn_auth_value,expected_recv_data', [
|
|
196
|
+
# Verify the invalid value is retained, since the panel is trusted, if no
|
|
197
|
+
# modifications to the value is made
|
|
198
|
+
pytest.param(
|
|
199
|
+
None, [
|
|
200
|
+
b'ISTART[212,212,""]IEND\0',
|
|
201
|
+
b'ISTART[213,213,[213,'
|
|
202
|
+
b'[0,"123456789",1,1,"","user","pwd",333]'
|
|
203
|
+
b']]IEND\0'
|
|
204
|
+
], id='Device with invalid APN auth value unmodified'
|
|
205
|
+
),
|
|
206
|
+
# Verify the invalid value is replaced with valid one when modified
|
|
207
|
+
pytest.param(
|
|
208
|
+
G90APNAuth.PAP, [
|
|
209
|
+
b'ISTART[212,212,""]IEND\0',
|
|
210
|
+
b'ISTART[213,213,[213,'
|
|
211
|
+
b'[0,"123456789",1,1,"","user","pwd",1]'
|
|
212
|
+
b']]IEND\0'
|
|
213
|
+
], id='Device with invalid APN auth value modified to valid value'
|
|
214
|
+
),
|
|
215
|
+
])
|
|
216
|
+
@pytest.mark.g90device(sent_data=[
|
|
217
|
+
b'ISTART[212,'
|
|
218
|
+
b'[0,"123456789",1,1,"","user","pwd",333,"54321"]'
|
|
219
|
+
b']IEND\0',
|
|
220
|
+
b'ISTARTIEND\0'
|
|
221
|
+
])
|
|
222
|
+
async def test_net_config_apn_auth_invalid(
|
|
223
|
+
new_apn_auth_value: Optional[G90APNAuth],
|
|
224
|
+
expected_recv_data: list[bytes],
|
|
225
|
+
mock_device: DeviceMock
|
|
226
|
+
) -> None:
|
|
227
|
+
"""
|
|
228
|
+
Tests for handling network configuration with invalid APN authentication
|
|
229
|
+
method value.
|
|
230
|
+
"""
|
|
231
|
+
g90 = G90Alarm(host=mock_device.host, port=mock_device.port)
|
|
232
|
+
|
|
233
|
+
# Retrieve configuration
|
|
234
|
+
cfg = await g90.net_config()
|
|
235
|
+
assert isinstance(cfg, G90NetConfig)
|
|
236
|
+
|
|
237
|
+
# Verify retrieved value is mapped to NONE enum value
|
|
238
|
+
assert cfg.apn_auth == G90APNAuth.NONE
|
|
239
|
+
|
|
240
|
+
# Modify the value if requested
|
|
241
|
+
if new_apn_auth_value is not None:
|
|
242
|
+
cfg.apn_auth = new_apn_auth_value
|
|
243
|
+
# Save the configuration
|
|
244
|
+
await cfg.save()
|
|
245
|
+
|
|
246
|
+
# Verify data sent to the device
|
|
247
|
+
assert await mock_device.recv_data == expected_recv_data
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_dataclass_load_save_descriptor.py
RENAMED
|
File without changes
|
{pyg90alarm-2.5.1 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_dataclass_load_save_serialize.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|