pyg90alarm 2.5.2__tar.gz → 2.6.0__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 (96) hide show
  1. pyg90alarm-2.6.0/.github/workflows/release.yaml +45 -0
  2. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/MANIFEST.in +1 -0
  3. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/PKG-INFO +1 -1
  4. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/__init__.py +3 -2
  5. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/host_info.py +34 -6
  6. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/net_config.py +15 -1
  7. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm.egg-info/PKG-INFO +1 -1
  8. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm.egg-info/SOURCES.txt +1 -0
  9. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_alarm.py +7 -0
  10. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_net_config.py +55 -0
  11. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/.github/CODEOWNERS +0 -0
  12. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/.github/dependabot.yml +0 -0
  13. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/.github/workflows/main.yml +0 -0
  14. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/.gitignore +0 -0
  15. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/.pylintrc +0 -0
  16. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/.readthedocs.yaml +0 -0
  17. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/LICENSE +0 -0
  18. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/README.rst +0 -0
  19. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/docs/.DS_Store +0 -0
  20. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/docs/.gitignore +0 -0
  21. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/docs/api-docs.rst +0 -0
  22. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/docs/cloud-protocol.rst +0 -0
  23. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/docs/conf.py +0 -0
  24. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/docs/index.rst +0 -0
  25. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/docs/local-protocol.rst +0 -0
  26. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/docs/requirements.txt +0 -0
  27. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/pyproject.toml +0 -0
  28. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/setup.cfg +0 -0
  29. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/setup.py +0 -0
  30. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/sonar-project.properties +0 -0
  31. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/alarm.py +0 -0
  32. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/callback.py +0 -0
  33. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/cloud/__init__.py +0 -0
  34. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/cloud/const.py +0 -0
  35. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/cloud/messages.py +0 -0
  36. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/cloud/notifications.py +0 -0
  37. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/cloud/protocol.py +0 -0
  38. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/const.py +0 -0
  39. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/dataclass/__init__.py +0 -0
  40. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/dataclass/load_save.py +0 -0
  41. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/dataclass/validation.py +0 -0
  42. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/definitions/__init__.py +0 -0
  43. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/definitions/base.py +0 -0
  44. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/definitions/devices.py +0 -0
  45. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/definitions/sensors.py +0 -0
  46. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/entities/__init__.py +0 -0
  47. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/entities/base_entity.py +0 -0
  48. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/entities/base_list.py +0 -0
  49. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/entities/device.py +0 -0
  50. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/entities/device_list.py +0 -0
  51. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/entities/sensor.py +0 -0
  52. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/entities/sensor_list.py +0 -0
  53. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/event_mapping.py +0 -0
  54. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/exceptions.py +0 -0
  55. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/__init__.py +0 -0
  56. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/alarm_phones.py +0 -0
  57. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/alert_config.py +0 -0
  58. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/base_cmd.py +0 -0
  59. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/config.py +0 -0
  60. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/discovery.py +0 -0
  61. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/history.py +0 -0
  62. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/host_config.py +0 -0
  63. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/host_status.py +0 -0
  64. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/notifications.py +0 -0
  65. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/paginated_cmd.py +0 -0
  66. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/paginated_result.py +0 -0
  67. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/targeted_discovery.py +0 -0
  68. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/local/user_data_crc.py +0 -0
  69. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/notifications/__init__.py +0 -0
  70. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/notifications/base.py +0 -0
  71. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/notifications/protocol.py +0 -0
  72. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm/py.typed +0 -0
  73. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm.egg-info/dependency_links.txt +0 -0
  74. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm.egg-info/requires.txt +0 -0
  75. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/src/pyg90alarm.egg-info/top_level.txt +0 -0
  76. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/__init__.py +0 -0
  77. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/conftest.py +0 -0
  78. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/device_mock.py +0 -0
  79. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_alarm_phones.py +0 -0
  80. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_base_commands.py +0 -0
  81. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_cloud_notifications.py +0 -0
  82. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_config.py +0 -0
  83. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_devices.py +0 -0
  84. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_discovery.py +0 -0
  85. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_history.py +0 -0
  86. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_host_config.py +0 -0
  87. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_local_notifications.py +0 -0
  88. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_paginated_commands.py +0 -0
  89. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/test_sensor.py +0 -0
  90. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/unit/dataclass/test_dataclass_load_save.py +0 -0
  91. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/unit/dataclass/test_dataclass_load_save_descriptor.py +0 -0
  92. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/unit/dataclass/test_dataclass_load_save_serialize.py +0 -0
  93. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/unit/dataclass/test_validation.py +0 -0
  94. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/unit/entities/test_base_list.py +0 -0
  95. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tests/unit/test_exceptions.py +0 -0
  96. {pyg90alarm-2.5.2 → pyg90alarm-2.6.0}/tox.ini +0 -0
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: Release
3
+
4
+ on: # yamllint disable rule:truthy
5
+ workflow_dispatch:
6
+ push:
7
+ branches:
8
+ - master
9
+ - main
10
+
11
+ permissions:
12
+ contents: write
13
+ issues: write
14
+ pull-requests: write
15
+
16
+ jobs:
17
+ release:
18
+ name: Release with semantic-release
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout code (SSH)
22
+ uses: actions/checkout@v6
23
+ with:
24
+ fetch-depth: 0
25
+ ssh-key: ${{ secrets.DEPLOY_KEY }}
26
+
27
+ - name: Setup Node.js
28
+ uses: actions/setup-node@v6
29
+ with:
30
+ node-version: '24'
31
+ cache: 'npm'
32
+ cache-dependency-path: '**/.github/workflows/*.yaml'
33
+
34
+ - name: Run semantic-release
35
+ env:
36
+ GIT_AUTHOR_NAME: "github-actions[bot]"
37
+ GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com"
38
+ GIT_COMMITTER_NAME: "github-actions[bot]"
39
+ GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com"
40
+ GITHUB_TOKEN: ${{ github.token }}
41
+ run: |
42
+ npx -y \
43
+ -p semantic-release@25.0.2 \
44
+ -p conventional-changelog-conventionalcommits@9.1.0 \
45
+ semantic-release
@@ -12,3 +12,4 @@ include setup.py
12
12
  recursive-include src *.py py.typed
13
13
 
14
14
  exclude requirements_dev.txt
15
+ exclude .releaserc.yaml
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyg90alarm
3
- Version: 2.5.2
3
+ Version: 2.6.0
4
4
  Summary: G90 Alarm system protocol
5
5
  Home-page: https://github.com/hostcc/pyg90alarm
6
6
  Author: Ilia Sotnikov
@@ -33,7 +33,8 @@ from .entities.sensor import (
33
33
  )
34
34
  from .entities.device import G90Device
35
35
  from .local.host_info import (
36
- G90HostInfo, G90HostInfoWifiStatus, G90HostInfoGsmStatus
36
+ G90HostInfo, G90HostInfoWifiStatus, G90HostInfoGsmStatus,
37
+ G90HostInfoWifiSetupProgress,
37
38
  )
38
39
  from .definitions.sensors import (
39
40
  G90SensorDefinitions
@@ -81,7 +82,7 @@ __all__ = [
81
82
  'G90Device',
82
83
  # Panel information and status
83
84
  'G90HostInfo', 'G90HostInfoWifiStatus', 'G90HostInfoGsmStatus',
84
- 'G90HostStatus',
85
+ 'G90HostStatus', 'G90HostInfoWifiSetupProgress',
85
86
  # Types for alerts and notifications
86
87
  'G90MessageTypes', 'G90NotificationTypes', 'G90ArmDisarmTypes',
87
88
  'G90AlertTypes', 'G90AlertSources', 'G90AlertStates',
@@ -43,10 +43,23 @@ class G90HostInfoWifiStatus(IntEnum):
43
43
  """
44
44
  POWERED_OFF = 0
45
45
  NOT_CONNECTED = 1
46
- NO_SIGNAL = 2
46
+ SERVER_NOT_CONNECTED = 2
47
47
  OPERATIONAL = 3
48
48
 
49
49
 
50
+ class G90HostInfoWifiSetupProgress(IntEnum):
51
+ """
52
+ Defines possible values of Wifi connection progress.
53
+ """
54
+ IDLE = 0
55
+ CONNECTING = 1
56
+ OK = 2
57
+ WRONG_SSID = 3
58
+ WRONG_PASSWORD = 4
59
+ CONNECTION_ERROR = 5
60
+ WIFI_ERROR = 6
61
+
62
+
50
63
  @dataclass
51
64
  class G90HostInfo: # pylint: disable=too-many-instance-attributes
52
65
  """
@@ -60,11 +73,11 @@ class G90HostInfo: # pylint: disable=too-many-instance-attributes
60
73
  wifi_hw_version: str
61
74
  gsm_status_data: int
62
75
  wifi_status_data: int
63
- reserved1: int
64
- reserved2: int
65
- band_frequency: str
66
- gsm_signal_level: int
67
- wifi_signal_level: int
76
+ gprs_3g_active_data: int
77
+ wifi_setup_progress_data: int
78
+ battery_voltage: str # in mV
79
+ gsm_signal_level: int # percentage 0-100
80
+ wifi_signal_level: int # percentage 0-100
68
81
 
69
82
  @property
70
83
  def gsm_status(self) -> G90HostInfoGsmStatus:
@@ -82,6 +95,21 @@ class G90HostInfo: # pylint: disable=too-many-instance-attributes
82
95
  """
83
96
  return G90HostInfoWifiStatus(self.wifi_status_data)
84
97
 
98
+ @property
99
+ def wifi_setup_progress(self) -> G90HostInfoWifiSetupProgress:
100
+ """
101
+ Translates the Wifi connection progress received from the device into
102
+ corresponding enum.
103
+ """
104
+ return G90HostInfoWifiSetupProgress(self.wifi_setup_progress_data)
105
+
106
+ @property
107
+ def gprs_3g_active(self) -> bool:
108
+ """
109
+ Indicates whether GPRS/3G is enabled.
110
+ """
111
+ return bool(self.gprs_3g_active_data)
112
+
85
113
  def _asdict(self) -> Dict[str, Any]:
86
114
  """
87
115
  Returns the host information as dictionary.
@@ -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.6.0
4
4
  Summary: G90 Alarm system protocol
5
5
  Home-page: https://github.com/hostcc/pyg90alarm
6
6
  Author: Ilia Sotnikov
@@ -12,6 +12,7 @@ tox.ini
12
12
  .github/CODEOWNERS
13
13
  .github/dependabot.yml
14
14
  .github/workflows/main.yml
15
+ .github/workflows/release.yaml
15
16
  docs/.DS_Store
16
17
  docs/.gitignore
17
18
  docs/api-docs.rst
@@ -11,6 +11,7 @@ from pyg90alarm.alarm import (
11
11
  )
12
12
  from pyg90alarm.local.host_info import (
13
13
  G90HostInfo, G90HostInfoGsmStatus, G90HostInfoWifiStatus,
14
+ G90HostInfoWifiSetupProgress,
14
15
  )
15
16
  from pyg90alarm.local.host_status import (
16
17
  G90HostStatus,
@@ -63,6 +64,12 @@ async def test_host_info(mock_device: DeviceMock) -> None:
63
64
  assert res.product_name == 'DUMMYPRODUCT'
64
65
  assert res.gsm_status == G90HostInfoGsmStatus.OPERATIONAL
65
66
  assert res.wifi_status == G90HostInfoWifiStatus.OPERATIONAL
67
+ assert res.wifi_setup_progress == G90HostInfoWifiSetupProgress.OK
68
+ assert res.gprs_3g_active is False
69
+ assert res.battery_voltage == '4242'
70
+ assert res.gsm_signal_level == 50
71
+ assert res.wifi_signal_level == 100
72
+
66
73
  assert isinstance(res._asdict(), dict)
67
74
 
68
75
 
@@ -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