pyg90alarm 2.7.0__py3-none-any.whl → 2.7.1__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.
- pyg90alarm/alarm.py +11 -11
- pyg90alarm/cloud/messages.py +1 -1
- pyg90alarm/cloud/notifications.py +12 -10
- pyg90alarm/cloud/protocol.py +2 -2
- pyg90alarm/const.py +2 -2
- pyg90alarm/local/notifications.py +5 -5
- {pyg90alarm-2.7.0.dist-info → pyg90alarm-2.7.1.dist-info}/METADATA +3 -3
- {pyg90alarm-2.7.0.dist-info → pyg90alarm-2.7.1.dist-info}/RECORD +11 -11
- {pyg90alarm-2.7.0.dist-info → pyg90alarm-2.7.1.dist-info}/WHEEL +0 -0
- {pyg90alarm-2.7.0.dist-info → pyg90alarm-2.7.1.dist-info}/licenses/LICENSE +0 -0
- {pyg90alarm-2.7.0.dist-info → pyg90alarm-2.7.1.dist-info}/top_level.txt +0 -0
pyg90alarm/alarm.py
CHANGED
|
@@ -64,9 +64,9 @@ from .const import (
|
|
|
64
64
|
REMOTE_PORT,
|
|
65
65
|
REMOTE_TARGETED_DISCOVERY_PORT,
|
|
66
66
|
LOCAL_TARGETED_DISCOVERY_PORT,
|
|
67
|
-
|
|
67
|
+
LOCAL_NOTIFICATIONS_IP,
|
|
68
68
|
LOCAL_NOTIFICATIONS_PORT,
|
|
69
|
-
|
|
69
|
+
LOCAL_CLOUD_NOTIFICATIONS_IP,
|
|
70
70
|
LOCAL_CLOUD_NOTIFICATIONS_PORT,
|
|
71
71
|
REMOTE_CLOUD_PORT,
|
|
72
72
|
DEVICE_REGISTRATION_TIMEOUT,
|
|
@@ -1379,7 +1379,7 @@ class G90Alarm(G90NotificationProtocol):
|
|
|
1379
1379
|
await asyncio.sleep(interval)
|
|
1380
1380
|
|
|
1381
1381
|
async def use_local_notifications(
|
|
1382
|
-
self,
|
|
1382
|
+
self, notifications_local_ip: str = LOCAL_NOTIFICATIONS_IP,
|
|
1383
1383
|
notifications_local_port: int = LOCAL_NOTIFICATIONS_PORT
|
|
1384
1384
|
) -> None:
|
|
1385
1385
|
"""
|
|
@@ -1391,16 +1391,16 @@ class G90Alarm(G90NotificationProtocol):
|
|
|
1391
1391
|
protocol_factory=lambda: self,
|
|
1392
1392
|
host=self._host,
|
|
1393
1393
|
port=self._port,
|
|
1394
|
-
|
|
1394
|
+
local_ip=notifications_local_ip,
|
|
1395
1395
|
local_port=notifications_local_port
|
|
1396
1396
|
)
|
|
1397
1397
|
|
|
1398
1398
|
# pylint: disable=too-many-positional-arguments
|
|
1399
1399
|
async def use_cloud_notifications(
|
|
1400
1400
|
self,
|
|
1401
|
-
|
|
1401
|
+
cloud_ip: str,
|
|
1402
1402
|
cloud_port: int,
|
|
1403
|
-
|
|
1403
|
+
cloud_local_ip: str = LOCAL_CLOUD_NOTIFICATIONS_IP,
|
|
1404
1404
|
cloud_local_port: int = LOCAL_CLOUD_NOTIFICATIONS_PORT,
|
|
1405
1405
|
upstream_host: Optional[str] = None,
|
|
1406
1406
|
upstream_port: Optional[int] = REMOTE_CLOUD_PORT,
|
|
@@ -1415,11 +1415,11 @@ class G90Alarm(G90NotificationProtocol):
|
|
|
1415
1415
|
of that is configuring cloud server address on the panel is one-time
|
|
1416
1416
|
operation, while the method will be called multiple times.
|
|
1417
1417
|
|
|
1418
|
-
:param
|
|
1419
|
-
reachable from the panel
|
|
1418
|
+
:param cloud_ip: The IP address of cloud server to connect to, should
|
|
1419
|
+
be reachable from the panel
|
|
1420
1420
|
:param cloud_port: The cloud server port to connect to, should be
|
|
1421
1421
|
reachable from the panel
|
|
1422
|
-
:param
|
|
1422
|
+
:param cloud_local_ip: Local IP address to bind cloud notifications
|
|
1423
1423
|
listener to
|
|
1424
1424
|
:param cloud_local_port: Local port to bind cloud notifications
|
|
1425
1425
|
listener to, should match `cloud_port` above unless network setup
|
|
@@ -1437,9 +1437,9 @@ class G90Alarm(G90NotificationProtocol):
|
|
|
1437
1437
|
protocol_factory=lambda: self,
|
|
1438
1438
|
upstream_host=upstream_host,
|
|
1439
1439
|
upstream_port=upstream_port,
|
|
1440
|
-
|
|
1440
|
+
local_ip=cloud_local_ip,
|
|
1441
1441
|
local_port=cloud_local_port,
|
|
1442
|
-
|
|
1442
|
+
cloud_ip=cloud_ip,
|
|
1443
1443
|
cloud_port=cloud_port,
|
|
1444
1444
|
keep_single_connection=keep_single_connection
|
|
1445
1445
|
)
|
pyg90alarm/cloud/messages.py
CHANGED
|
@@ -226,7 +226,7 @@ class G90CloudHelloDiscoveryRespMessage(G90CloudMessage):
|
|
|
226
226
|
_LOGGER.debug(
|
|
227
227
|
"%s: Timestamp added: %s", type(self).__name__, str(self)
|
|
228
228
|
)
|
|
229
|
-
self.ip_addr = context.
|
|
229
|
+
self.ip_addr = context.cloud_ip.encode()
|
|
230
230
|
self.port = context.cloud_port
|
|
231
231
|
|
|
232
232
|
@property
|
|
@@ -61,7 +61,9 @@ class G90CloudNotifications(G90NotificationsBase, asyncio.Protocol):
|
|
|
61
61
|
|
|
62
62
|
:param protocol_factory: Factory function to create notification
|
|
63
63
|
protocol handlers
|
|
64
|
-
:param
|
|
64
|
+
:param cloud_ip: Cloud IP address to announce to the panel
|
|
65
|
+
:param cloud_port: Cloud port to announce to the panel
|
|
66
|
+
:param local_ip: Local IP to bind the server to
|
|
65
67
|
:param local_port: Local port to bind the server to
|
|
66
68
|
:param upstream_host: Optional upstream host to forward messages to
|
|
67
69
|
:param upstream_port: Optional upstream port to forward messages to
|
|
@@ -73,8 +75,8 @@ class G90CloudNotifications(G90NotificationsBase, asyncio.Protocol):
|
|
|
73
75
|
def __init__(
|
|
74
76
|
self,
|
|
75
77
|
protocol_factory: Callable[[], G90NotificationProtocol],
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
local_ip: str, local_port: int,
|
|
79
|
+
cloud_ip: str, cloud_port: int,
|
|
78
80
|
upstream_host: Optional[str] = None,
|
|
79
81
|
upstream_port: Optional[int] = None,
|
|
80
82
|
keep_single_connection: bool = True,
|
|
@@ -82,9 +84,9 @@ class G90CloudNotifications(G90NotificationsBase, asyncio.Protocol):
|
|
|
82
84
|
super().__init__(protocol_factory)
|
|
83
85
|
self._transport: Optional[Transport] = None
|
|
84
86
|
self._server: Optional[asyncio.Server] = None
|
|
85
|
-
self.
|
|
87
|
+
self._local_ip = local_ip
|
|
86
88
|
self._local_port = local_port
|
|
87
|
-
self.
|
|
89
|
+
self._cloud_ip = cloud_ip
|
|
88
90
|
self._cloud_port = cloud_port
|
|
89
91
|
self._upstream_host = upstream_host
|
|
90
92
|
self._upstream_port = upstream_port
|
|
@@ -164,9 +166,9 @@ class G90CloudNotifications(G90NotificationsBase, asyncio.Protocol):
|
|
|
164
166
|
# Instantiate a context for the messages
|
|
165
167
|
ctx = G90CloudMessageContext(
|
|
166
168
|
device_id=self.device_id,
|
|
167
|
-
|
|
169
|
+
local_ip=self._local_ip,
|
|
168
170
|
local_port=self._local_port,
|
|
169
|
-
|
|
171
|
+
cloud_ip=self._cloud_ip,
|
|
170
172
|
cloud_port=self._cloud_port,
|
|
171
173
|
upstream_host=self._upstream_host,
|
|
172
174
|
upstream_port=self._upstream_port,
|
|
@@ -373,11 +375,11 @@ class G90CloudNotifications(G90NotificationsBase, asyncio.Protocol):
|
|
|
373
375
|
loop = asyncio.get_running_loop()
|
|
374
376
|
|
|
375
377
|
_LOGGER.debug('Creating cloud endpoint for %s:%s',
|
|
376
|
-
self.
|
|
378
|
+
self._local_ip,
|
|
377
379
|
self._local_port)
|
|
378
380
|
self._server = await loop.create_server(
|
|
379
381
|
lambda: self,
|
|
380
|
-
self.
|
|
382
|
+
self._local_ip, self._local_port
|
|
381
383
|
)
|
|
382
384
|
|
|
383
385
|
async def close(self) -> None:
|
|
@@ -406,7 +408,7 @@ class G90CloudNotifications(G90NotificationsBase, asyncio.Protocol):
|
|
|
406
408
|
if self._server:
|
|
407
409
|
_LOGGER.debug(
|
|
408
410
|
'No longer listening for cloud connections on %s:%s',
|
|
409
|
-
self.
|
|
411
|
+
self._local_ip, self._local_port
|
|
410
412
|
)
|
|
411
413
|
self._server.close()
|
|
412
414
|
self._server = None
|
pyg90alarm/cloud/protocol.py
CHANGED
|
@@ -73,11 +73,11 @@ class G90CloudMessageContext: # pylint:disable=too-many-instance-attributes
|
|
|
73
73
|
This class holds information about the local and remote hosts and ports,
|
|
74
74
|
as well as the cloud server and upstream connection details.
|
|
75
75
|
"""
|
|
76
|
-
|
|
76
|
+
local_ip: str
|
|
77
77
|
local_port: int
|
|
78
78
|
remote_host: str
|
|
79
79
|
remote_port: int
|
|
80
|
-
|
|
80
|
+
cloud_ip: str
|
|
81
81
|
cloud_port: int
|
|
82
82
|
upstream_host: Optional[str]
|
|
83
83
|
upstream_port: Optional[int]
|
pyg90alarm/const.py
CHANGED
|
@@ -28,9 +28,9 @@ from typing import Optional
|
|
|
28
28
|
REMOTE_PORT = 12368
|
|
29
29
|
REMOTE_TARGETED_DISCOVERY_PORT = 12900
|
|
30
30
|
LOCAL_TARGETED_DISCOVERY_PORT = 12901
|
|
31
|
-
|
|
31
|
+
LOCAL_NOTIFICATIONS_IP = '0.0.0.0'
|
|
32
32
|
LOCAL_NOTIFICATIONS_PORT = 12901
|
|
33
|
-
|
|
33
|
+
LOCAL_CLOUD_NOTIFICATIONS_IP = '0.0.0.0'
|
|
34
34
|
LOCAL_CLOUD_NOTIFICATIONS_PORT = 5678
|
|
35
35
|
REMOTE_CLOUD_PORT = 5678
|
|
36
36
|
DEVICE_REGISTRATION_TIMEOUT = 30
|
|
@@ -52,19 +52,19 @@ class G90LocalNotifications(G90NotificationsBase, DatagramProtocol):
|
|
|
52
52
|
:param host: The host on which the device is listening for notifications.
|
|
53
53
|
:param local_port: The port on which the local host is listening for
|
|
54
54
|
notifications.
|
|
55
|
-
:param
|
|
55
|
+
:param local_ip: The IP address on which the local host is listening for
|
|
56
56
|
notifications.
|
|
57
57
|
"""
|
|
58
58
|
# pylint:disable=too-many-positional-arguments,too-many-arguments
|
|
59
59
|
def __init__(
|
|
60
60
|
self, protocol_factory: Callable[[], G90NotificationProtocol],
|
|
61
|
-
port: int, host: str, local_port: int,
|
|
61
|
+
port: int, host: str, local_port: int, local_ip: str,
|
|
62
62
|
):
|
|
63
63
|
super().__init__(protocol_factory)
|
|
64
64
|
|
|
65
65
|
self._host = host
|
|
66
66
|
self._port = port
|
|
67
|
-
self.
|
|
67
|
+
self._notifications_local_ip = local_ip
|
|
68
68
|
self._notifications_local_port = local_port
|
|
69
69
|
|
|
70
70
|
# Implementation of datagram protocol,
|
|
@@ -107,11 +107,11 @@ class G90LocalNotifications(G90NotificationsBase, DatagramProtocol):
|
|
|
107
107
|
loop = asyncio.get_running_loop()
|
|
108
108
|
|
|
109
109
|
_LOGGER.debug('Creating UDP endpoint for %s:%s',
|
|
110
|
-
self.
|
|
110
|
+
self._notifications_local_ip,
|
|
111
111
|
self._notifications_local_port)
|
|
112
112
|
(self._transport,
|
|
113
113
|
_protocol) = await loop.create_datagram_endpoint(
|
|
114
114
|
lambda: self,
|
|
115
115
|
local_addr=(
|
|
116
|
-
self.
|
|
116
|
+
self._notifications_local_ip, self._notifications_local_port
|
|
117
117
|
))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyg90alarm
|
|
3
|
-
Version: 2.7.
|
|
3
|
+
Version: 2.7.1
|
|
4
4
|
Summary: G90 Alarm system protocol
|
|
5
5
|
Home-page: https://github.com/hostcc/pyg90alarm
|
|
6
6
|
Author: Ilia Sotnikov
|
|
@@ -224,7 +224,7 @@ The code fragments below demonstrate how to utilize both modes - please note tho
|
|
|
224
224
|
await alarm.use_cloud_notifications(
|
|
225
225
|
# The host/port the package will listen on for the cloud notifications,
|
|
226
226
|
# should match ones above.
|
|
227
|
-
|
|
227
|
+
cloud_ip='<host IP address running the package>',
|
|
228
228
|
cloud_port=5678,
|
|
229
229
|
cloud_local_port=5678,
|
|
230
230
|
upstream_host=None
|
|
@@ -252,7 +252,7 @@ The code fragments below demonstrate how to utilize both modes - please note tho
|
|
|
252
252
|
await alarm.use_cloud_notifications(
|
|
253
253
|
# The host/port the package will listen on for the cloud notifications,
|
|
254
254
|
# should match ones above.
|
|
255
|
-
|
|
255
|
+
cloud_ip='<host IP address running the package>',
|
|
256
256
|
cloud_port=5678,
|
|
257
257
|
cloud_local_port=5678,
|
|
258
258
|
# Upstream cloud server address the package should forward the
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
pyg90alarm/__init__.py,sha256=Z1Y5bwYmtY5iycIv6IDQ464o4Q-sU7fo9S3f94NGOpg,3786
|
|
2
|
-
pyg90alarm/alarm.py,sha256=
|
|
2
|
+
pyg90alarm/alarm.py,sha256=3ct1UbLKSnazVKRxQvAi1N1cazT-EoEcp_ttHJu8L-g,54147
|
|
3
3
|
pyg90alarm/callback.py,sha256=9PVtjRs2MLn80AgiM-UJNL8ZJF4_PxcopJIpxMmB3vc,4707
|
|
4
|
-
pyg90alarm/const.py,sha256=
|
|
4
|
+
pyg90alarm/const.py,sha256=DKM1c3meX0kPnCm8g9b65o5UYm-89mgBv1we8ypLVFI,8674
|
|
5
5
|
pyg90alarm/event_mapping.py,sha256=hSmRWkkuA5hlauGvYakdOrw8QFt0TMNfUuDQ4J3vHpQ,3438
|
|
6
6
|
pyg90alarm/exceptions.py,sha256=9rSd5zIKALHtRHBBLD-R5zxW-5OBkHK04uVupCnAK8s,1937
|
|
7
7
|
pyg90alarm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
pyg90alarm/cloud/__init__.py,sha256=u7ZzrIwCsdgmBmgtpCe6c_Kipdo8nG8PEOEcaAHXCxI,1407
|
|
9
9
|
pyg90alarm/cloud/const.py,sha256=FYUxkj0DSI7nnXZHsJMfv8RNQiXKV3TYKGHSdfHdMjg,2113
|
|
10
|
-
pyg90alarm/cloud/messages.py,sha256=
|
|
11
|
-
pyg90alarm/cloud/notifications.py,sha256=
|
|
12
|
-
pyg90alarm/cloud/protocol.py,sha256=
|
|
10
|
+
pyg90alarm/cloud/messages.py,sha256=kpaEPagzsK_fQZmNNIliz3F3KXi-xLXzR0AYze4CMKI,17674
|
|
11
|
+
pyg90alarm/cloud/notifications.py,sha256=yW9ye2qgoE3djKFN-y6UKScBkmzaCm5wKFbovjoLFPU,15818
|
|
12
|
+
pyg90alarm/cloud/protocol.py,sha256=pr7jwukZr8jKUApqAsTfX9U8mZS8DXlVNRPcdio3lqI,16155
|
|
13
13
|
pyg90alarm/dataclass/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
pyg90alarm/dataclass/load_save.py,sha256=I2WDeW4GingN8AEiwZm9Epf1gVL_Ynkise2h781Dn3I,8604
|
|
15
15
|
pyg90alarm/dataclass/validation.py,sha256=yd3Q86S0L5NekzoiVFW5SwpefbIhWpwvsS-S15X4Sf8,19107
|
|
@@ -35,7 +35,7 @@ pyg90alarm/local/host_config.py,sha256=RSvg2UXPTCzzwDW6Iz3CyFtjxPUzSSdlxRMqGpWA6
|
|
|
35
35
|
pyg90alarm/local/host_info.py,sha256=gdneg2XxxMNSFfNTjXCqsBsLZgZr_wg38sudKJ24RD8,3550
|
|
36
36
|
pyg90alarm/local/host_status.py,sha256=WHGtw-A0wHILqVWP4DnZhXj8DPRGyS26AV0bL1isTz4,1863
|
|
37
37
|
pyg90alarm/local/net_config.py,sha256=Y4-SUVSukk-h5x3LK-HH3IlM72dP_46nj1H8lN9rTfo,5998
|
|
38
|
-
pyg90alarm/local/notifications.py,sha256=
|
|
38
|
+
pyg90alarm/local/notifications.py,sha256=T9Tfi_e_q0yIJEU_6A1XpBUhLVORWfNnlilQRwLx5n4,4585
|
|
39
39
|
pyg90alarm/local/paginated_cmd.py,sha256=mgk46Xz7vJP9qv2YZlUIzGhxRKReuydKVgcj-f8DkvE,4300
|
|
40
40
|
pyg90alarm/local/paginated_result.py,sha256=p_e8QAVznp1Q5Xi9ifjb9Bx-S3ZiAkVlPKrY6r0bYLs,5483
|
|
41
41
|
pyg90alarm/local/system_cmd.py,sha256=LtkrGlBEjZKaNsycWDLS2lt8NLasWgRAMpMtpAD7AOk,8770
|
|
@@ -44,8 +44,8 @@ pyg90alarm/local/user_data_crc.py,sha256=JQBOPY3RlOgVtvR55R-rM8OuKjYW-BPXQ0W4pi6
|
|
|
44
44
|
pyg90alarm/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
45
|
pyg90alarm/notifications/base.py,sha256=d3N_zNPa_jcTX4QpA78jdgMHDhmrgwqyM3HdvuO14Jk,16682
|
|
46
46
|
pyg90alarm/notifications/protocol.py,sha256=TlZQ3P8-N-E2X5bzkGefz432x4lBYyIBF9VriwYn9ds,4790
|
|
47
|
-
pyg90alarm-2.7.
|
|
48
|
-
pyg90alarm-2.7.
|
|
49
|
-
pyg90alarm-2.7.
|
|
50
|
-
pyg90alarm-2.7.
|
|
51
|
-
pyg90alarm-2.7.
|
|
47
|
+
pyg90alarm-2.7.1.dist-info/licenses/LICENSE,sha256=f884inRbeNv-O-hbwz62Ro_1J8xiHRTnJ2cCx6A0WvU,1070
|
|
48
|
+
pyg90alarm-2.7.1.dist-info/METADATA,sha256=vQ43pgpWnoP3zPamoD0IgtDrDPZ8lY5C-B8l2dNyUsg,11955
|
|
49
|
+
pyg90alarm-2.7.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
50
|
+
pyg90alarm-2.7.1.dist-info/top_level.txt,sha256=czHiGxYMyTk5QEDTDb0EpPiKqUMRa8zI4zx58Ii409M,11
|
|
51
|
+
pyg90alarm-2.7.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|