pyg90alarm 2.5.2__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.
Files changed (95) hide show
  1. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/PKG-INFO +1 -1
  2. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/net_config.py +15 -1
  3. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/PKG-INFO +1 -1
  4. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_net_config.py +55 -0
  5. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/.github/CODEOWNERS +0 -0
  6. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/.github/dependabot.yml +0 -0
  7. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/.github/workflows/main.yml +0 -0
  8. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/.gitignore +0 -0
  9. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/.pylintrc +0 -0
  10. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/.readthedocs.yaml +0 -0
  11. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/LICENSE +0 -0
  12. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/MANIFEST.in +0 -0
  13. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/README.rst +0 -0
  14. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/docs/.DS_Store +0 -0
  15. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/docs/.gitignore +0 -0
  16. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/docs/api-docs.rst +0 -0
  17. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/docs/cloud-protocol.rst +0 -0
  18. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/docs/conf.py +0 -0
  19. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/docs/index.rst +0 -0
  20. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/docs/local-protocol.rst +0 -0
  21. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/docs/requirements.txt +0 -0
  22. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/pyproject.toml +0 -0
  23. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/setup.cfg +0 -0
  24. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/setup.py +0 -0
  25. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/sonar-project.properties +0 -0
  26. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/__init__.py +0 -0
  27. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/alarm.py +0 -0
  28. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/callback.py +0 -0
  29. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/__init__.py +0 -0
  30. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/const.py +0 -0
  31. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/messages.py +0 -0
  32. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/notifications.py +0 -0
  33. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/cloud/protocol.py +0 -0
  34. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/const.py +0 -0
  35. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/dataclass/__init__.py +0 -0
  36. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/dataclass/load_save.py +0 -0
  37. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/dataclass/validation.py +0 -0
  38. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/definitions/__init__.py +0 -0
  39. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/definitions/base.py +0 -0
  40. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/definitions/devices.py +0 -0
  41. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/definitions/sensors.py +0 -0
  42. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/__init__.py +0 -0
  43. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/base_entity.py +0 -0
  44. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/base_list.py +0 -0
  45. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/device.py +0 -0
  46. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/device_list.py +0 -0
  47. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/sensor.py +0 -0
  48. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/entities/sensor_list.py +0 -0
  49. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/event_mapping.py +0 -0
  50. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/exceptions.py +0 -0
  51. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/__init__.py +0 -0
  52. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/alarm_phones.py +0 -0
  53. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/alert_config.py +0 -0
  54. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/base_cmd.py +0 -0
  55. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/config.py +0 -0
  56. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/discovery.py +0 -0
  57. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/history.py +0 -0
  58. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/host_config.py +0 -0
  59. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/host_info.py +0 -0
  60. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/host_status.py +0 -0
  61. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/notifications.py +0 -0
  62. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/paginated_cmd.py +0 -0
  63. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/paginated_result.py +0 -0
  64. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/targeted_discovery.py +0 -0
  65. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/local/user_data_crc.py +0 -0
  66. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/notifications/__init__.py +0 -0
  67. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/notifications/base.py +0 -0
  68. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/notifications/protocol.py +0 -0
  69. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm/py.typed +0 -0
  70. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/SOURCES.txt +0 -0
  71. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/dependency_links.txt +0 -0
  72. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/requires.txt +0 -0
  73. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/src/pyg90alarm.egg-info/top_level.txt +0 -0
  74. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/__init__.py +0 -0
  75. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/conftest.py +0 -0
  76. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/device_mock.py +0 -0
  77. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_alarm.py +0 -0
  78. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_alarm_phones.py +0 -0
  79. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_base_commands.py +0 -0
  80. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_cloud_notifications.py +0 -0
  81. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_config.py +0 -0
  82. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_devices.py +0 -0
  83. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_discovery.py +0 -0
  84. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_history.py +0 -0
  85. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_host_config.py +0 -0
  86. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_local_notifications.py +0 -0
  87. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_paginated_commands.py +0 -0
  88. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/test_sensor.py +0 -0
  89. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_dataclass_load_save.py +0 -0
  90. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_dataclass_load_save_descriptor.py +0 -0
  91. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_dataclass_load_save_serialize.py +0 -0
  92. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/unit/dataclass/test_validation.py +0 -0
  93. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/unit/entities/test_base_list.py +0 -0
  94. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tests/unit/test_exceptions.py +0 -0
  95. {pyg90alarm-2.5.2 → pyg90alarm-2.5.3}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyg90alarm
3
- Version: 2.5.2
3
+ Version: 2.5.3
4
4
  Summary: G90 Alarm system protocol
5
5
  Home-page: https://github.com/hostcc/pyg90alarm
6
6
  Author: Ilia Sotnikov
@@ -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
- return G90APNAuth(self._apn_auth)
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyg90alarm
3
- Version: 2.5.2
3
+ Version: 2.5.3
4
4
  Summary: G90 Alarm system protocol
5
5
  Home-page: https://github.com/hostcc/pyg90alarm
6
6
  Author: Ilia Sotnikov
@@ -190,3 +190,58 @@ async def test_net_config_apn_name_empty(
190
190
  b'[0,"123456789",1,1,"","user","pwd",3]'
191
191
  b']]IEND\0'
192
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