pyg90alarm 1.19.0__py3-none-any.whl → 2.0.0__py3-none-any.whl

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 (34) hide show
  1. pyg90alarm/__init__.py +5 -5
  2. pyg90alarm/alarm.py +159 -114
  3. pyg90alarm/cloud/__init__.py +31 -0
  4. pyg90alarm/cloud/const.py +56 -0
  5. pyg90alarm/cloud/messages.py +593 -0
  6. pyg90alarm/cloud/notifications.py +409 -0
  7. pyg90alarm/cloud/protocol.py +518 -0
  8. pyg90alarm/const.py +5 -0
  9. pyg90alarm/entities/base_entity.py +83 -0
  10. pyg90alarm/entities/base_list.py +165 -0
  11. pyg90alarm/entities/device_list.py +58 -0
  12. pyg90alarm/entities/sensor.py +63 -3
  13. pyg90alarm/entities/sensor_list.py +50 -0
  14. pyg90alarm/local/__init__.py +0 -0
  15. pyg90alarm/{base_cmd.py → local/base_cmd.py} +3 -6
  16. pyg90alarm/{discovery.py → local/discovery.py} +1 -1
  17. pyg90alarm/{history.py → local/history.py} +4 -2
  18. pyg90alarm/{host_status.py → local/host_status.py} +1 -1
  19. pyg90alarm/local/notifications.py +116 -0
  20. pyg90alarm/{paginated_cmd.py → local/paginated_cmd.py} +2 -2
  21. pyg90alarm/{paginated_result.py → local/paginated_result.py} +1 -1
  22. pyg90alarm/{targeted_discovery.py → local/targeted_discovery.py} +2 -2
  23. pyg90alarm/notifications/__init__.py +0 -0
  24. pyg90alarm/{device_notifications.py → notifications/base.py} +115 -173
  25. pyg90alarm/notifications/protocol.py +116 -0
  26. {pyg90alarm-1.19.0.dist-info → pyg90alarm-2.0.0.dist-info}/METADATA +112 -18
  27. pyg90alarm-2.0.0.dist-info/RECORD +40 -0
  28. {pyg90alarm-1.19.0.dist-info → pyg90alarm-2.0.0.dist-info}/WHEEL +1 -1
  29. pyg90alarm-1.19.0.dist-info/RECORD +0 -27
  30. /pyg90alarm/{config.py → local/config.py} +0 -0
  31. /pyg90alarm/{host_info.py → local/host_info.py} +0 -0
  32. /pyg90alarm/{user_data_crc.py → local/user_data_crc.py} +0 -0
  33. {pyg90alarm-1.19.0.dist-info → pyg90alarm-2.0.0.dist-info/licenses}/LICENSE +0 -0
  34. {pyg90alarm-1.19.0.dist-info → pyg90alarm-2.0.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pyg90alarm
3
- Version: 1.19.0
3
+ Version: 2.0.0
4
4
  Summary: G90 Alarm system protocol
5
5
  Home-page: https://github.com/hostcc/pyg90alarm
6
6
  Author: Ilia Sotnikov
@@ -15,14 +15,13 @@ Classifier: Topic :: Home Automation
15
15
  Classifier: Topic :: System :: Hardware
16
16
  Classifier: License :: OSI Approved :: MIT License
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.8
19
18
  Classifier: Programming Language :: Python :: 3.9
20
19
  Classifier: Programming Language :: Python :: 3.10
21
20
  Classifier: Programming Language :: Python :: 3.11
22
21
  Classifier: Programming Language :: Python :: 3.12
23
22
  Classifier: Programming Language :: Python :: 3.13
24
23
  Classifier: Programming Language :: Python :: 3 :: Only
25
- Requires-Python: >=3.8, <4
24
+ Requires-Python: >=3.9, <4
26
25
  Description-Content-Type: text/x-rst
27
26
  License-File: LICENSE
28
27
  Provides-Extra: dev
@@ -33,6 +32,18 @@ Requires-Dist: asynctest; extra == "test"
33
32
  Provides-Extra: docs
34
33
  Requires-Dist: sphinx; extra == "docs"
35
34
  Requires-Dist: sphinx-rtd-theme; extra == "docs"
35
+ Dynamic: author
36
+ Dynamic: author-email
37
+ Dynamic: classifier
38
+ Dynamic: description
39
+ Dynamic: description-content-type
40
+ Dynamic: home-page
41
+ Dynamic: keywords
42
+ Dynamic: license-file
43
+ Dynamic: project-url
44
+ Dynamic: provides-extra
45
+ Dynamic: requires-python
46
+ Dynamic: summary
36
47
 
37
48
  .. image:: https://github.com/hostcc/pyg90alarm/actions/workflows/main.yml/badge.svg?branch=master
38
49
  :target: https://github.com/hostcc/pyg90alarm/tree/master
@@ -125,22 +136,14 @@ Known caveats
125
136
  contact sensors though, since an intruder cutting the line will trigger the
126
137
  alarm.
127
138
 
128
- Enabling device notifications
129
- =============================
139
+ Device notifications
140
+ ====================
130
141
 
131
- There is a hidden device capability to send protocol notifications over the
132
- WiFi interface. The notifications are done using broadcast UDP packets with
133
- source/destination ports being ``45000:12901`` (non-configurable), and sent when
134
- the device has IP address of its WiFi interface set to ``10.10.10.250``. That is
135
- the same IP the device will allocate to the WiFi interface when AP (access
136
- point is enabled). Please note enabling the AP *is not* required for the
137
- notifications to be sent, only the IP address matters. Likely the firmware does
138
- a check internally and enables those when corresponding IP address is found on
139
- the WiFi interface.
142
+ Local notifications
143
+ -------------------
140
144
 
141
- Please see
142
- `protocol documentation <https://pyg90alarm.readthedocs.io/en/stable/protocol.html>`_
143
- for further details on the device notifications.
145
+ There is a hidden device capability to send protocol notifications over the
146
+ WiFi interface, thus called local. The notifications are done using broadcast UDP packets with source/destination ports being ``45000:12901`` (non-configurable), and sent when the device has IP address of its WiFi interface set to ``10.10.10.250``. That is the same IP the device will allocate to the WiFi interface when AP (access point is enabled). Please note enabling the AP *is not* required for the notifications to be sent, only the IP address matters. Likely the firmware does a check internally and enables those when corresponding IP address is found on the WiFi interface.
144
147
 
145
148
  Depending on your network setup, ensuring the `10.10.10.250` IP address is
146
149
  allocated to the WiFi interface of the device might be as simple as DHCP
@@ -167,6 +170,97 @@ set the IP address allocation up.
167
170
  alert to be enabled in the mobile application, otherwise it won't be
168
171
  recorded in the history.
169
172
 
173
+ For the local notifications to be enabled the ```G90Alarm.use_local_notifications()``` needs to be called upon contstucting an instance of ``G90Alarm`` class, then ```G90Alarm.listen_notifications()`z to start processing those coming from the panel - the code fragment below demonstrate that though being incomplete since callbacks (e.g. ``G90Alarm.on_armdisarm()``) should be set for the actual processing of the notifications.
174
+
175
+ .. code:: python
176
+
177
+ from pyg90alarm import G90Alarm
178
+
179
+ # Create an instance of the alarm panel
180
+ alarm = G90Alarm(host='10.10.10.250')
181
+ # Enable local notifications
182
+ await alarm.use_local_notifications()
183
+ # Start listening for notifications
184
+ await alarm.listen_notifications()
185
+
186
+ Cloud notifications
187
+ -------------------
188
+
189
+ The cloud protocol is native to the panel and is used to interact with mobile application. The package can mimic the cloud server and interpret the messages the panel sends to the cloud, allowing to receive the notifications and alerts.
190
+ While the protocol also allows to send commands to the panel, it is not implemented and local protocol is used for that - i.e. when cloud notifications are in use the local protocol still utilized for sending commands to the panel.
191
+
192
+ The cloud protocol is TCP based and typically interacts with cloud service at known IP address and port (not customizeable at panel side). To process the cloud notifications all the traffic from panel towards the cloud (IP address ``47.88.7.61`` and TCP port ``5678`` as of writing) needs to be diverted to the node where the package is running - depending on your network equipment it could be port forwarding, DNAT or other means. It is unclear whether the panel utilizes DNS to resolve the cloud service IP address, hence the documentation only mentions IP-based traffic redirection.
193
+
194
+ Please see
195
+ `cloud-protocol.rst <docs/cloud-protocol.rst>`_ for further details on the protocol.
196
+
197
+ The benefit of the cloud notifications is that the panel no longer required to have ``10.10.10.250`` IP address.
198
+
199
+ The package could act as:
200
+
201
+ - Standalone cloud server with no Internet connectivity or cloud service
202
+ required at all - good if you'd like to avoid having a vendor service involved. Please note the mobile application will show panel as offline in this mode
203
+ - Chained cloud server, where in addition to intepreting the notifications it
204
+ will also forward all packets received from the panel to the cloud server, and pass its responses back to the panel. This allows to have notificaitons processed by the package and the mobile application working as well.
205
+
206
+ .. note:: Sending packets upstream to the known IP address and port of the cloud server might result in those looped back (since traffic from panel to cloud service has to be redirected to the host where package runs), if your network equipment can't account for source address in redirection rules (i.e. limiting the port redirection to the panel's IP address). In that case you'll need another redirection, from the host where the package runs to the cloud service using an IP from your network. That way those two redirection rules will coexist correctly. To illustate:
207
+
208
+ Port forwarding rule 1:
209
+
210
+ - Source: panel IP address
211
+ - Destination: 47.88.7.61
212
+ - Port: 5678
213
+ - Redirect to host: host where package runs
214
+ - Redirect to port: 5678 (or other port if you want to use it)
215
+
216
+ Port forwarding rule 2 (optional):
217
+
218
+ - Source: host where package runs
219
+ - Destination: an IP address from your network
220
+ - Port: 5678 (or other port if you want to use it)
221
+ - Redirect to : 47.88.7.61
222
+ - Redirect to port: 5678
223
+
224
+ The code fragments below demonstrate how to utilize both modes - please note those are incomplete, since no callbacks are set to process the notifications.
225
+
226
+ **Standalone mode**
227
+
228
+ .. code:: python
229
+
230
+ from pyg90alarm import G90Alarm
231
+
232
+ # Create an instance of the alarm panel
233
+ alarm = G90Alarm(host='<panel IP address>')
234
+ # Enable cloud notifications
235
+ await alarm.use_cloud_notifications(
236
+ # Optional, see note above redirecting cloud traffic from panel
237
+ local_port=5678,
238
+ upstream_host=None
239
+ )
240
+ # Start listening for notifications
241
+ await alarm.listen_notifications()
242
+
243
+
244
+ **Chained mode**
245
+
246
+ .. code:: python
247
+
248
+ from pyg90alarm import G90Alarm
249
+
250
+ # Create an instance of the alarm panel
251
+ alarm = G90Alarm(host='<panel IP address>')
252
+ # Enable cloud notifications
253
+ await alarm.use_cloud_notifications(
254
+ # Optional, see note above redirecting cloud traffic from panel
255
+ local_port=5678,
256
+ # See note above re: cloud service and sending packets to it
257
+ upstream_host='47.88.7.61',
258
+ upstream_port=5678
259
+ )
260
+ # Start listening for notifications
261
+ await alarm.listen_notifications()
262
+
263
+
170
264
  Quick start
171
265
  ===========
172
266
 
@@ -0,0 +1,40 @@
1
+ pyg90alarm/__init__.py,sha256=Gpl_3jd5Ye_O8rVG2GJg7FvgFEqcp-qNj5UBK9GBLwM,2258
2
+ pyg90alarm/alarm.py,sha256=qAtU3JHUclsaAJCeHkX6f00tUKhk4otZwlG7TDIy6Og,41229
3
+ pyg90alarm/callback.py,sha256=3JsD_JChmZD24OyjaCP-PxxuBDBX7myGYhkM4RN7bk4,3742
4
+ pyg90alarm/const.py,sha256=F1qqwZFZeLLhb2AFv22dIIc6Ri0NPcHjmIsYXK7RYAI,6775
5
+ pyg90alarm/exceptions.py,sha256=eiOcRe7D18EIPyPFDNU9DdFgbnkwPmkiLl8lGPOhBNw,1475
6
+ pyg90alarm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ pyg90alarm/cloud/__init__.py,sha256=u7ZzrIwCsdgmBmgtpCe6c_Kipdo8nG8PEOEcaAHXCxI,1407
8
+ pyg90alarm/cloud/const.py,sha256=FYUxkj0DSI7nnXZHsJMfv8RNQiXKV3TYKGHSdfHdMjg,2113
9
+ pyg90alarm/cloud/messages.py,sha256=iH8PZ77Dz-ksTQpIMRFFKQI3gmIjKBTsfLeou8SyjIA,18003
10
+ pyg90alarm/cloud/notifications.py,sha256=4n0pIpv_TH_9EXZQyqTjNc_AOJPT8DmxlpiPAGz0D1o,15598
11
+ pyg90alarm/cloud/protocol.py,sha256=82l2IXSM12tv_iWkTrAQZ-aw5UR4tmWFQJKVcgBfIww,16159
12
+ pyg90alarm/definitions/__init__.py,sha256=s0NZnkW_gMH718DJbgez28z9WA231CyszUf1O_ojUiI,68
13
+ pyg90alarm/definitions/sensors.py,sha256=rKOu21ZpI44xk6aMh_vBjniFqnsNTc1CKwAvnv4PYLQ,19904
14
+ pyg90alarm/entities/__init__.py,sha256=hHb6AOiC4Tz--rOWiiICMdLaZDs1Tf_xpWk_HeS_gO4,66
15
+ pyg90alarm/entities/base_entity.py,sha256=Ea1r1aP7FMnOiEPhBhkrndmcr5Iy8jcfQuuXCNHajrU,2473
16
+ pyg90alarm/entities/base_list.py,sha256=76DUtdXTwd26vv6HIw_qdtBNd1FqMfoRf0VI9KxV5aA,5703
17
+ pyg90alarm/entities/device.py,sha256=f_LHvKCAqTEebZ4mrRh3CpPUI7o-OvpvOfyTRCbftJs,2818
18
+ pyg90alarm/entities/device_list.py,sha256=FrsfzP1BgwCKOn6bzVUpQHdatB6MUcWhPeuaJ3c5mqg,2154
19
+ pyg90alarm/entities/sensor.py,sha256=ax-6ttps7sCWfuP6CcnS00Zy5WZVKleO8vAsdhU3KQc,21986
20
+ pyg90alarm/entities/sensor_list.py,sha256=qLNbLZXrPlcdZLoyZw3Mzf1PwX4BiW3z6SKi_NqhVnM,1806
21
+ pyg90alarm/local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ pyg90alarm/local/base_cmd.py,sha256=NNaSXqNWEuxtxrz3l7gLwVodpuzESWvt0mYQC9pIBTY,9812
23
+ pyg90alarm/local/config.py,sha256=2YtIgdT7clQXmYvkdn_fhIdS05CY8E1Yc90R8_tAmRI,1961
24
+ pyg90alarm/local/discovery.py,sha256=8YVIXuNe57lhas0VSRf7QXZH83pEDGNj9oehNY4Kh2U,3576
25
+ pyg90alarm/local/history.py,sha256=v_deRl62tHeysydyeLRvyHJwcBMnKonsEbXXSXb8XP8,9138
26
+ pyg90alarm/local/host_info.py,sha256=4lFIaFEpYd3EvgNrDJmKijTrzX9i29nFISLLlXGnkmE,2759
27
+ pyg90alarm/local/host_status.py,sha256=WHGtw-A0wHILqVWP4DnZhXj8DPRGyS26AV0bL1isTz4,1863
28
+ pyg90alarm/local/notifications.py,sha256=TGNaRxI2BL2wWhT2YbDIyRn5iwGA0lXjwdMD8go2eRE,4555
29
+ pyg90alarm/local/paginated_cmd.py,sha256=bUCtuCYec2pWkufY43sx3gCYE0prysbFY7seegUtkRw,4441
30
+ pyg90alarm/local/paginated_result.py,sha256=knvFKtpswtVnC-1Av5vbVYhL5bue60qKmo4p6FCv0_k,5448
31
+ pyg90alarm/local/targeted_discovery.py,sha256=Ik2C2VBtVLurf3-RKko4O2R3B6MrmFdOskd457uyASU,5516
32
+ pyg90alarm/local/user_data_crc.py,sha256=JQBOPY3RlOgVtvR55R-rM8OuKjYW-BPXQ0W4pi6CEH0,1689
33
+ pyg90alarm/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
+ pyg90alarm/notifications/base.py,sha256=KXZkhFLO-cNcGOLIItxoZr0FaI8ohzlD3njcWVqkOb0,15218
35
+ pyg90alarm/notifications/protocol.py,sha256=1d9rLIX_EwLpH36rXTm6xYS00TNVGCZi88n86VDcQX0,4076
36
+ pyg90alarm-2.0.0.dist-info/licenses/LICENSE,sha256=f884inRbeNv-O-hbwz62Ro_1J8xiHRTnJ2cCx6A0WvU,1070
37
+ pyg90alarm-2.0.0.dist-info/METADATA,sha256=dC8wPKqEcVmY0az_oz0vmPS69ZMgE-iM9MmtZaPGL98,12569
38
+ pyg90alarm-2.0.0.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
39
+ pyg90alarm-2.0.0.dist-info/top_level.txt,sha256=czHiGxYMyTk5QEDTDb0EpPiKqUMRa8zI4zx58Ii409M,11
40
+ pyg90alarm-2.0.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (78.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,27 +0,0 @@
1
- pyg90alarm/__init__.py,sha256=5AITRm5jZSzuQaL7PS8fZZMZb4-IuGRhSqyAdfTt0Cs,2236
2
- pyg90alarm/alarm.py,sha256=dOhe2C2zsJ55VE5NJF-PE7pKRF_YOCF70ACJbDYEgF8,40196
3
- pyg90alarm/base_cmd.py,sha256=Bz7yoZ0RpkcjWARya664DKAPo3goD6BeaKtuW-hA804,9902
4
- pyg90alarm/callback.py,sha256=3JsD_JChmZD24OyjaCP-PxxuBDBX7myGYhkM4RN7bk4,3742
5
- pyg90alarm/config.py,sha256=2YtIgdT7clQXmYvkdn_fhIdS05CY8E1Yc90R8_tAmRI,1961
6
- pyg90alarm/const.py,sha256=uBzDUSlVO3FZxLI11bzfCm6JTI2_ciageyf43JLSehg,6632
7
- pyg90alarm/device_notifications.py,sha256=pqkeKYORUUZUEovUKajuu8JHCtXD0ulAZIKelNfn2Eg,17602
8
- pyg90alarm/discovery.py,sha256=fwyBHDCKGej06OwhpbVCHYTRU9WWkeYysAFgv3FiwqI,3575
9
- pyg90alarm/exceptions.py,sha256=eiOcRe7D18EIPyPFDNU9DdFgbnkwPmkiLl8lGPOhBNw,1475
10
- pyg90alarm/history.py,sha256=5NfgB0V-7TZlMNHEjtRbOA0ZtJfQTgh2ysZIg5RM7ck,9080
11
- pyg90alarm/host_info.py,sha256=4lFIaFEpYd3EvgNrDJmKijTrzX9i29nFISLLlXGnkmE,2759
12
- pyg90alarm/host_status.py,sha256=4XhuilBzB8XsXkpeWj3PAVpmDPcTnBBOYunO21Flabo,1862
13
- pyg90alarm/paginated_cmd.py,sha256=vJ8slMS7aNLpkAxnIe25EHstusYy1bYTl1j306ps-MQ,4439
14
- pyg90alarm/paginated_result.py,sha256=Zs_yB9UW6VlHRBPIzOwHy8ZJ0FqCUPMB-rmfPG2BdnU,5447
15
- pyg90alarm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- pyg90alarm/targeted_discovery.py,sha256=h0SijMpPQ12iBZtfh4xsaP_HIbiQRNBnXsd0-K9rjHA,5514
17
- pyg90alarm/user_data_crc.py,sha256=JQBOPY3RlOgVtvR55R-rM8OuKjYW-BPXQ0W4pi6CEH0,1689
18
- pyg90alarm/definitions/__init__.py,sha256=s0NZnkW_gMH718DJbgez28z9WA231CyszUf1O_ojUiI,68
19
- pyg90alarm/definitions/sensors.py,sha256=rKOu21ZpI44xk6aMh_vBjniFqnsNTc1CKwAvnv4PYLQ,19904
20
- pyg90alarm/entities/__init__.py,sha256=hHb6AOiC4Tz--rOWiiICMdLaZDs1Tf_xpWk_HeS_gO4,66
21
- pyg90alarm/entities/device.py,sha256=f_LHvKCAqTEebZ4mrRh3CpPUI7o-OvpvOfyTRCbftJs,2818
22
- pyg90alarm/entities/sensor.py,sha256=2FiFlH9JTw_5yprFUSHzRNfQB-TRMhcTJqa-zNVm0Ak,20324
23
- pyg90alarm-1.19.0.dist-info/LICENSE,sha256=f884inRbeNv-O-hbwz62Ro_1J8xiHRTnJ2cCx6A0WvU,1070
24
- pyg90alarm-1.19.0.dist-info/METADATA,sha256=kHSIfs1IrWMBkor4nWhqM3Tsn4CEZodb5NKKQ4x3COg,7714
25
- pyg90alarm-1.19.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
26
- pyg90alarm-1.19.0.dist-info/top_level.txt,sha256=czHiGxYMyTk5QEDTDb0EpPiKqUMRa8zI4zx58Ii409M,11
27
- pyg90alarm-1.19.0.dist-info/RECORD,,
File without changes
File without changes
File without changes