qolsys-controller 0.0.40__py3-none-any.whl → 0.0.51__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.
Potentially problematic release.
This version of qolsys-controller might be problematic. Click here for more details.
- qolsys_controller/controller.py +19 -7
- qolsys_controller/database/db.py +31 -0
- qolsys_controller/database/table.py +16 -1
- qolsys_controller/database/table_powerg_device.py +1 -1
- qolsys_controller/enum.py +0 -1
- qolsys_controller/enum_zwave.py +0 -1
- qolsys_controller/mdns.py +8 -3
- qolsys_controller/panel.py +116 -48
- qolsys_controller/partition.py +1 -1
- qolsys_controller/plugin.py +10 -20
- qolsys_controller/plugin_c4.py +1 -1
- qolsys_controller/plugin_remote.py +110 -115
- qolsys_controller/settings.py +24 -15
- qolsys_controller/state.py +43 -7
- qolsys_controller/weather.py +74 -0
- qolsys_controller/zone.py +120 -10
- {qolsys_controller-0.0.40.dist-info → qolsys_controller-0.0.51.dist-info}/METADATA +1 -1
- {qolsys_controller-0.0.40.dist-info → qolsys_controller-0.0.51.dist-info}/RECORD +20 -19
- {qolsys_controller-0.0.40.dist-info → qolsys_controller-0.0.51.dist-info}/WHEEL +0 -0
- {qolsys_controller-0.0.40.dist-info → qolsys_controller-0.0.51.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import asyncio
|
|
2
4
|
import base64
|
|
3
5
|
import contextlib
|
|
@@ -7,33 +9,34 @@ import logging
|
|
|
7
9
|
import random
|
|
8
10
|
import ssl
|
|
9
11
|
import uuid
|
|
12
|
+
from typing import TYPE_CHECKING
|
|
10
13
|
|
|
11
14
|
import aiofiles
|
|
12
15
|
import aiomqtt
|
|
13
16
|
|
|
14
17
|
from .enum import PartitionAlarmState, PartitionSystemStatus
|
|
15
|
-
from .enum_zwave import ThermostatFanMode, ThermostatMode
|
|
16
18
|
from .errors import QolsysMqttError, QolsysSslError
|
|
17
19
|
from .mdns import QolsysMDNS
|
|
18
20
|
from .mqtt_command_queue import QolsysMqttCommandQueue
|
|
19
|
-
from .panel import QolsysPanel
|
|
20
21
|
from .pki import QolsysPKI
|
|
21
22
|
from .plugin import QolsysPlugin
|
|
22
|
-
from .settings import QolsysSettings
|
|
23
|
-
from .state import QolsysState
|
|
24
23
|
from .task_manager import QolsysTaskManager
|
|
25
24
|
from .utils_mqtt import generate_random_mac
|
|
26
25
|
|
|
27
26
|
LOGGER = logging.getLogger(__name__)
|
|
28
27
|
|
|
28
|
+
if TYPE_CHECKING:
|
|
29
|
+
from .controller import QolsysController
|
|
30
|
+
from .enum_zwave import ThermostatFanMode, ThermostatMode
|
|
31
|
+
|
|
29
32
|
|
|
30
33
|
class QolsysPluginRemote(QolsysPlugin):
|
|
31
34
|
|
|
32
|
-
def __init__(self,
|
|
33
|
-
super().__init__(
|
|
35
|
+
def __init__(self, controller: QolsysController) -> None:
|
|
36
|
+
super().__init__(controller=controller)
|
|
34
37
|
|
|
35
38
|
# PKI
|
|
36
|
-
self._pki = QolsysPKI(settings=settings)
|
|
39
|
+
self._pki = QolsysPKI(settings=controller.settings)
|
|
37
40
|
self._auto_discover_pki = True
|
|
38
41
|
|
|
39
42
|
# Plugin
|
|
@@ -84,20 +87,14 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
84
87
|
self._auto_discover_pki = value
|
|
85
88
|
|
|
86
89
|
def is_paired(self) -> bool:
|
|
87
|
-
# Check if plugin is paired:
|
|
88
|
-
# 1- random_mac set
|
|
89
|
-
# 2- KEY file present
|
|
90
|
-
# 3- Signed certificate file present
|
|
91
|
-
# 4- Qolsys certificate present
|
|
92
|
-
# 5- Qolsys Panel IP present
|
|
93
90
|
return (
|
|
94
91
|
self._pki.id != "" and
|
|
95
92
|
self._pki.check_key_file() and
|
|
96
93
|
self._pki.check_cer_file() and
|
|
97
94
|
self._pki.check_qolsys_cer_file() and
|
|
98
95
|
self._pki.check_secure_file() and
|
|
99
|
-
self.settings.check_panel_ip() and
|
|
100
|
-
self.settings.check_plugin_ip()
|
|
96
|
+
self._controller.settings.check_panel_ip() and
|
|
97
|
+
self._controller.settings.check_plugin_ip()
|
|
101
98
|
)
|
|
102
99
|
|
|
103
100
|
async def config(self, start_pairing: bool) -> bool:
|
|
@@ -108,24 +105,24 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
108
105
|
super().config()
|
|
109
106
|
|
|
110
107
|
# Check and created config_directory
|
|
111
|
-
if not self.settings.check_config_directory(create=start_pairing):
|
|
108
|
+
if not self._controller.settings.check_config_directory(create=start_pairing):
|
|
112
109
|
return False
|
|
113
110
|
|
|
114
111
|
# Read user file for access code
|
|
115
112
|
loop = asyncio.get_running_loop()
|
|
116
|
-
if not loop.run_in_executor(None, self.panel.read_users_file):
|
|
113
|
+
if not loop.run_in_executor(None, self._controller.panel.read_users_file):
|
|
117
114
|
return False
|
|
118
115
|
|
|
119
116
|
# Config PKI
|
|
120
117
|
if self._auto_discover_pki:
|
|
121
118
|
if self._pki.auto_discover_pki():
|
|
122
|
-
self.settings.random_mac = self._pki.formatted_id()
|
|
119
|
+
self._controller.settings.random_mac = self._pki.formatted_id()
|
|
123
120
|
else:
|
|
124
|
-
self._pki.set_id(self.settings.random_mac)
|
|
121
|
+
self._pki.set_id(self._controller.settings.random_mac)
|
|
125
122
|
|
|
126
123
|
# Set mqtt_remote_client_id
|
|
127
|
-
self.settings.mqtt_remote_client_id = "qolsys-controller-" + self._pki.formatted_id()
|
|
128
|
-
LOGGER.debug("Using MQTT remoteClientID: %s", self.settings.mqtt_remote_client_id)
|
|
124
|
+
self._controller.settings.mqtt_remote_client_id = "qolsys-controller-" + self._pki.formatted_id()
|
|
125
|
+
LOGGER.debug("Using MQTT remoteClientID: %s", self._controller.settings.mqtt_remote_client_id)
|
|
129
126
|
|
|
130
127
|
# Check if plugin is paired
|
|
131
128
|
if self.is_paired():
|
|
@@ -187,51 +184,51 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
187
184
|
while True:
|
|
188
185
|
try:
|
|
189
186
|
self.aiomqtt = aiomqtt.Client(
|
|
190
|
-
hostname=self.settings.panel_ip,
|
|
187
|
+
hostname=self._controller.settings.panel_ip,
|
|
191
188
|
port=8883,
|
|
192
189
|
tls_params=tls_params,
|
|
193
190
|
tls_insecure=True,
|
|
194
191
|
clean_session=True,
|
|
195
|
-
timeout=self.settings.mqtt_timeout,
|
|
196
|
-
identifier= self.settings.mqtt_remote_client_id,
|
|
192
|
+
timeout=self._controller.settings.mqtt_timeout,
|
|
193
|
+
identifier= self._controller.settings.mqtt_remote_client_id,
|
|
197
194
|
)
|
|
198
195
|
|
|
199
196
|
await self.aiomqtt.__aenter__()
|
|
200
197
|
|
|
201
198
|
LOGGER.info("MQTT: Client Connected")
|
|
202
199
|
|
|
203
|
-
# Subscribe to panel internal
|
|
200
|
+
# Subscribe to panel internal database updates
|
|
204
201
|
await self.aiomqtt.subscribe("iq2meid")
|
|
205
202
|
|
|
206
|
-
# Subscribte to MQTT
|
|
207
|
-
await self.aiomqtt.subscribe("response_" + self.settings.random_mac, qos=self.settings.mqtt_qos)
|
|
203
|
+
# Subscribte to MQTT private response
|
|
204
|
+
await self.aiomqtt.subscribe("response_" + self._controller.settings.random_mac, qos=self._controller.settings.mqtt_qos)
|
|
208
205
|
|
|
209
206
|
# Subscribe to Z-Wave response
|
|
210
|
-
await self.aiomqtt.subscribe("ZWAVE_RESPONSE", qos=self.settings.mqtt_qos)
|
|
207
|
+
await self.aiomqtt.subscribe("ZWAVE_RESPONSE", qos=self._controller.settings.mqtt_qos)
|
|
211
208
|
|
|
212
209
|
# Only log all traffic for debug purposes
|
|
213
210
|
if self.log_mqtt_mesages:
|
|
214
211
|
# Subscribe to MQTT commands send to panel by other devices
|
|
215
|
-
await self.aiomqtt.subscribe("mastermeid", qos=self.settings.mqtt_qos)
|
|
212
|
+
await self.aiomqtt.subscribe("mastermeid", qos=self._controller.settings.mqtt_qos)
|
|
216
213
|
|
|
217
214
|
# Subscribe to all topics
|
|
218
|
-
# await self.aiomqtt.subscribe("#", qos=self.settings.mqtt_qos)
|
|
215
|
+
# await self.aiomqtt.subscribe("#", qos=self._controller.settings.mqtt_qos)
|
|
219
216
|
|
|
220
217
|
self._task_manager.run(self.mqtt_listen_task(), self._mqtt_task_listen_label)
|
|
221
218
|
self._task_manager.run(self.mqtt_ping_task(), self._mqtt_task_ping_label)
|
|
222
219
|
|
|
223
220
|
response_connect = await self.command_connect()
|
|
224
|
-
self.panel.imei = response_connect.get("master_imei", "")
|
|
225
|
-
self.panel.product_type = response_connect.get("primary_product_type", "")
|
|
221
|
+
self._controller.panel.imei = response_connect.get("master_imei", "")
|
|
222
|
+
self._controller.panel.product_type = response_connect.get("primary_product_type", "")
|
|
226
223
|
|
|
227
224
|
await self.command_pingevent()
|
|
228
225
|
await self.command_pair_status_request()
|
|
229
226
|
|
|
230
227
|
response_database = await self.command_sync_database()
|
|
231
228
|
LOGGER.debug("MQTT: Updating State from syncdatabase")
|
|
232
|
-
self.panel.load_database(response_database.get("fulldbdata"))
|
|
233
|
-
self.panel.dump()
|
|
234
|
-
self.state.dump()
|
|
229
|
+
self._controller.panel.load_database(response_database.get("fulldbdata"))
|
|
230
|
+
self._controller.panel.dump()
|
|
231
|
+
self._controller.state.dump()
|
|
235
232
|
|
|
236
233
|
self.connected = True
|
|
237
234
|
self.connected_observer.notify()
|
|
@@ -252,8 +249,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
252
249
|
self.aiomqtt = None
|
|
253
250
|
|
|
254
251
|
if reconnect:
|
|
255
|
-
LOGGER.debug("MQTT Error - %s: Connect - Reconnecting in %s seconds ...", err, self.settings.mqtt_timeout)
|
|
256
|
-
await asyncio.sleep(self.settings.mqtt_timeout)
|
|
252
|
+
LOGGER.debug("MQTT Error - %s: Connect - Reconnecting in %s seconds ...", err, self._controller.settings.mqtt_timeout)
|
|
253
|
+
await asyncio.sleep(self._controller.settings.mqtt_timeout)
|
|
257
254
|
else:
|
|
258
255
|
raise QolsysMqttError from err
|
|
259
256
|
|
|
@@ -272,7 +269,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
272
269
|
with contextlib.suppress(aiomqtt.MqttError):
|
|
273
270
|
await self.command_pingevent()
|
|
274
271
|
|
|
275
|
-
await asyncio.sleep(self.settings.mqtt_ping)
|
|
272
|
+
await asyncio.sleep(self._controller.settings.mqtt_ping)
|
|
276
273
|
|
|
277
274
|
async def mqtt_listen_task(self) -> None:
|
|
278
275
|
try:
|
|
@@ -282,17 +279,15 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
282
279
|
LOGGER.debug("MQTT TOPIC: %s\n%s", message.topic, message.payload.decode())
|
|
283
280
|
|
|
284
281
|
# Panel response to MQTT Commands
|
|
285
|
-
if message.topic.matches("response_" + self.settings.random_mac):
|
|
282
|
+
if message.topic.matches("response_" + self._controller.settings.random_mac):
|
|
286
283
|
data = message.payload.decode()
|
|
287
|
-
# data = message.payload.decode().replace("\\\\", "\\")
|
|
288
|
-
# data = fix_json_string(data)
|
|
289
284
|
data = json.loads(data)
|
|
290
285
|
await self._mqtt_command_queue.handle_response(data)
|
|
291
286
|
|
|
292
287
|
# Panel updates to IQ2MEID database
|
|
293
288
|
if message.topic.matches("iq2meid"):
|
|
294
289
|
data = json.loads(message.payload.decode())
|
|
295
|
-
self.panel.parse_iq2meid_message(data)
|
|
290
|
+
self._controller.panel.parse_iq2meid_message(data)
|
|
296
291
|
|
|
297
292
|
# Panel Z-Wave response
|
|
298
293
|
if message.topic.matches("ZWAVE_RESPONSE"):
|
|
@@ -305,19 +300,19 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
305
300
|
self.connected = False
|
|
306
301
|
self.connected_observer.notify()
|
|
307
302
|
|
|
308
|
-
LOGGER.debug("%s: Listen - Reconnecting in %s seconds ...", err, self.settings.mqtt_timeout)
|
|
309
|
-
await asyncio.sleep(self.settings.mqtt_timeout)
|
|
303
|
+
LOGGER.debug("%s: Listen - Reconnecting in %s seconds ...", err, self._controller.settings.mqtt_timeout)
|
|
304
|
+
await asyncio.sleep(self._controller.settings.mqtt_timeout)
|
|
310
305
|
self._task_manager.run(self.mqtt_connect_task(reconnect=True, run_forever=True), self._mqtt_task_connect_label)
|
|
311
306
|
|
|
312
307
|
async def start_initial_pairing(self) -> bool:
|
|
313
308
|
# check if random_mac exist
|
|
314
|
-
if self.settings.random_mac == "":
|
|
309
|
+
if self._controller.settings.random_mac == "":
|
|
315
310
|
LOGGER.debug("Creating random_mac")
|
|
316
|
-
self.settings.random_mac = generate_random_mac()
|
|
317
|
-
self._pki.create(self.settings.random_mac, key_size=self.settings.key_size)
|
|
311
|
+
self._controller.settings.random_mac = generate_random_mac()
|
|
312
|
+
self._pki.create(self._controller.settings.random_mac, key_size=self._controller.settings.key_size)
|
|
318
313
|
|
|
319
314
|
# Check if PKI is valid
|
|
320
|
-
self._pki.set_id(self.settings.random_mac)
|
|
315
|
+
self._pki.set_id(self._controller.settings.random_mac)
|
|
321
316
|
LOGGER.debug("Checking PKI")
|
|
322
317
|
if not (
|
|
323
318
|
self._pki.check_key_file() and
|
|
@@ -329,19 +324,19 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
329
324
|
|
|
330
325
|
LOGGER.debug("Starting Pairing Process")
|
|
331
326
|
|
|
332
|
-
if not self.settings.check_plugin_ip():
|
|
327
|
+
if not self._controller.settings.check_plugin_ip():
|
|
333
328
|
LOGGER.error("Plugin IP Address not configured")
|
|
334
329
|
return False
|
|
335
330
|
|
|
336
331
|
# If we dont allready have client signed certificate, start the pairing server
|
|
337
|
-
if not self._pki.check_secure_file() or not self._pki.check_qolsys_cer_file() or not self.settings.check_panel_ip():
|
|
332
|
+
if not self._pki.check_secure_file() or not self._pki.check_qolsys_cer_file() or not self._controller.settings.check_panel_ip():
|
|
338
333
|
|
|
339
334
|
# High Level Random Pairing Port
|
|
340
335
|
pairing_port = random.randint(50000, 55000)
|
|
341
336
|
|
|
342
337
|
# Start Pairing mDNS Brodcast
|
|
343
|
-
LOGGER.debug("Starting mDNS Service Discovery: %s:%s", self.settings.plugin_ip, str(pairing_port))
|
|
344
|
-
mdns_server = QolsysMDNS(self.settings.plugin_ip, pairing_port)
|
|
338
|
+
LOGGER.debug("Starting mDNS Service Discovery: %s:%s", self._controller.settings.plugin_ip, str(pairing_port))
|
|
339
|
+
mdns_server = QolsysMDNS(self._controller.settings.plugin_ip, pairing_port)
|
|
345
340
|
await mdns_server.start_mdns()
|
|
346
341
|
|
|
347
342
|
# Start Key Exchange Server
|
|
@@ -349,7 +344,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
349
344
|
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
|
350
345
|
context.load_cert_chain(certfile=self._pki.cer_file_path, keyfile=self._pki.key_file_path)
|
|
351
346
|
self.certificate_exchange_server = await asyncio.start_server(self.handle_key_exchange_client,
|
|
352
|
-
self.settings.plugin_ip, pairing_port, ssl=context)
|
|
347
|
+
self._controller.settings.plugin_ip, pairing_port, ssl=context)
|
|
353
348
|
LOGGER.debug("Certificate Exchange Server Waiting for Panel")
|
|
354
349
|
LOGGER.debug("Press Pair Button in IQ Remote Config Page ...")
|
|
355
350
|
|
|
@@ -392,18 +387,18 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
392
387
|
LOGGER.debug("Receiving from Panel: %s", mac)
|
|
393
388
|
|
|
394
389
|
# Remove \x00 and \x01 from received string
|
|
395
|
-
self.settings.panel_mac = "".join(char for char in mac if char.isprintable())
|
|
396
|
-
self.settings.panel_ip = address
|
|
390
|
+
self._controller.settings.panel_mac = "".join(char for char in mac if char.isprintable())
|
|
391
|
+
self._controller.settings.panel_ip = address
|
|
397
392
|
received_panel_mac = True
|
|
398
393
|
|
|
399
394
|
# Sending random_mac to panel
|
|
400
|
-
message = b"\x00\x11" + self.settings.random_mac.encode()
|
|
395
|
+
message = b"\x00\x11" + self._controller.settings.random_mac.encode()
|
|
401
396
|
LOGGER.debug("Sending to Panel: %s", message.decode())
|
|
402
397
|
writer.write(message)
|
|
403
398
|
await writer.drain()
|
|
404
399
|
|
|
405
400
|
# Sending CSR File to panel
|
|
406
|
-
async with aiofiles.open(self._pki.csr_file_path, mode=
|
|
401
|
+
async with aiofiles.open(self._pki.csr_file_path, mode="rb") as f:
|
|
407
402
|
content = await f.read()
|
|
408
403
|
LOGGER.debug("Sending to Panel: [CSR File Content]")
|
|
409
404
|
writer.write(content)
|
|
@@ -453,17 +448,17 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
453
448
|
LOGGER.error("MQTT Client not configured")
|
|
454
449
|
raise QolsysMqttError
|
|
455
450
|
|
|
456
|
-
await self.aiomqtt.publish(topic=topic, payload=json.dumps(json_payload), qos=self.settings.mqtt_qos)
|
|
451
|
+
await self.aiomqtt.publish(topic=topic, payload=json.dumps(json_payload), qos=self._controller.settings.mqtt_qos)
|
|
457
452
|
return await self._mqtt_command_queue.wait_for_response(request_id)
|
|
458
453
|
|
|
459
454
|
async def command_connect(self) -> dict:
|
|
460
455
|
LOGGER.debug("MQTT: Sending connect command")
|
|
461
456
|
|
|
462
457
|
topic = "mastermeid"
|
|
463
|
-
ipAddress = self.settings.plugin_ip
|
|
458
|
+
ipAddress = self._controller.settings.plugin_ip
|
|
464
459
|
eventName = "connect_v204"
|
|
465
|
-
macAddress = self.settings.random_mac
|
|
466
|
-
remoteClientID = self.settings.mqtt_remote_client_id
|
|
460
|
+
macAddress = self._controller.settings.random_mac
|
|
461
|
+
remoteClientID = self._controller.settings.mqtt_remote_client_id
|
|
467
462
|
softwareVersion = "4.4.1"
|
|
468
463
|
producType = "tab07_rk68"
|
|
469
464
|
bssid = ""
|
|
@@ -482,8 +477,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
482
477
|
remote_panel_plugged = 1
|
|
483
478
|
remote_panel_battery_temperature = 430
|
|
484
479
|
requestID = str(uuid.uuid4())
|
|
485
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
486
|
-
remoteMacAddress = self.settings.random_mac
|
|
480
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
481
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
487
482
|
|
|
488
483
|
dhcpInfo = {
|
|
489
484
|
"ipaddress": "",
|
|
@@ -533,9 +528,9 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
533
528
|
|
|
534
529
|
topic = "mastermeid"
|
|
535
530
|
eventName = "pingevent"
|
|
536
|
-
macAddress = self.settings.random_mac
|
|
531
|
+
macAddress = self._controller.settings.random_mac
|
|
537
532
|
remote_panel_status = "Active"
|
|
538
|
-
ipAddress = self.settings.plugin_ip
|
|
533
|
+
ipAddress = self._controller.settings.plugin_ip
|
|
539
534
|
current_battery_status = "Normal"
|
|
540
535
|
remote_panel_battery_percentage = 100
|
|
541
536
|
remote_panel_battery_temperature = 430
|
|
@@ -548,8 +543,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
548
543
|
remote_panel_battery_health = 2
|
|
549
544
|
remote_panel_plugged = 1
|
|
550
545
|
requestID = str(uuid.uuid4())
|
|
551
|
-
remoteMacAddress = self.settings.random_mac
|
|
552
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
546
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
547
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
553
548
|
|
|
554
549
|
payload = {
|
|
555
550
|
"eventName": eventName,
|
|
@@ -582,8 +577,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
582
577
|
eventName = "timeSync"
|
|
583
578
|
startTimestamp = datetime.datetime.now().timestamp()
|
|
584
579
|
requestID = str(uuid.uuid4())
|
|
585
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
586
|
-
remoteMacAddress = self.settings.random_mac
|
|
580
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
581
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
587
582
|
|
|
588
583
|
payload = {
|
|
589
584
|
"eventName": eventName,
|
|
@@ -602,8 +597,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
602
597
|
topic = "mastermeid"
|
|
603
598
|
eventName = "syncdatabase"
|
|
604
599
|
requestID = str(uuid.uuid4())
|
|
605
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
606
|
-
remoteMacAddress = self.settings.random_mac
|
|
600
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
601
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
607
602
|
|
|
608
603
|
payload = {
|
|
609
604
|
"eventName": eventName,
|
|
@@ -622,8 +617,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
622
617
|
topic = "mastermeid"
|
|
623
618
|
eventName = "acStatus"
|
|
624
619
|
requestID = str(uuid.uuid4())
|
|
625
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
626
|
-
remoteMacAddress = self.settings.random_mac
|
|
620
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
621
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
627
622
|
acStatus = "Connected"
|
|
628
623
|
|
|
629
624
|
payload = {"eventName": eventName,
|
|
@@ -640,8 +635,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
640
635
|
topic = "mastermeid"
|
|
641
636
|
eventName = "dealerLogo"
|
|
642
637
|
requestID = str(uuid.uuid4())
|
|
643
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
644
|
-
remoteMacAddress = self.settings.random_mac
|
|
638
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
639
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
645
640
|
|
|
646
641
|
payload = {
|
|
647
642
|
"eventName": eventName,
|
|
@@ -657,9 +652,9 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
657
652
|
|
|
658
653
|
topic = "mastermeid"
|
|
659
654
|
eventName = "pair_status_request"
|
|
660
|
-
remoteMacAddress = self.settings.random_mac
|
|
655
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
661
656
|
requestID = str(uuid.uuid4())
|
|
662
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
657
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
663
658
|
|
|
664
659
|
payload = {
|
|
665
660
|
"eventName": eventName,
|
|
@@ -676,9 +671,9 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
676
671
|
|
|
677
672
|
topic = "mastermeid"
|
|
678
673
|
eventName = "disconnect"
|
|
679
|
-
remoteClientID = self.settings.mqtt_remote_client_id
|
|
674
|
+
remoteClientID = self._controller.settings.mqtt_remote_client_id
|
|
680
675
|
requestID = str(uuid.uuid4())
|
|
681
|
-
remoteMacAddress = self.settings.random_mac
|
|
676
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
682
677
|
|
|
683
678
|
payload = {
|
|
684
679
|
"eventName": eventName,
|
|
@@ -695,9 +690,9 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
695
690
|
topic = "mastermeid"
|
|
696
691
|
eventName = "connect_v204"
|
|
697
692
|
pairing_request = True
|
|
698
|
-
ipAddress = self.settings.plugin_ip
|
|
699
|
-
macAddress = self.settings.random_mac
|
|
700
|
-
remoteClientID = self.settings.mqtt_remote_client_id
|
|
693
|
+
ipAddress = self._controller.settings.plugin_ip
|
|
694
|
+
macAddress = self._controller.settings.random_mac
|
|
695
|
+
remoteClientID = self._controller.settings.mqtt_remote_client_id
|
|
701
696
|
softwareVersion = "4.4.1"
|
|
702
697
|
productType = "tab07_rk68"
|
|
703
698
|
bssid = ""
|
|
@@ -705,8 +700,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
705
700
|
dealerIconsCheckSum = ""
|
|
706
701
|
remote_feature_support_version = "1"
|
|
707
702
|
requestID = str(uuid.uuid4())
|
|
708
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
709
|
-
remoteMacAddress = self.settings.random_mac
|
|
703
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
704
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
710
705
|
|
|
711
706
|
dhcpInfo = {
|
|
712
707
|
"ipaddress": "",
|
|
@@ -744,7 +739,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
744
739
|
LOGGER.debug("MQTT: Sending ui_delay command")
|
|
745
740
|
|
|
746
741
|
# partition state needs to be sent for ui_delay to work
|
|
747
|
-
partition = self.state.partition(partition_id)
|
|
742
|
+
partition = self._controller.state.partition(partition_id)
|
|
748
743
|
|
|
749
744
|
arming_command = {
|
|
750
745
|
"operation_name": "ui_delay",
|
|
@@ -753,7 +748,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
753
748
|
"partitionID": partition_id, # STR EXPECTED
|
|
754
749
|
"silentDisarming":silent_disarming,
|
|
755
750
|
"operation_source": 1,
|
|
756
|
-
"macAddress": self.settings.random_mac,
|
|
751
|
+
"macAddress": self._controller.settings.random_mac,
|
|
757
752
|
}
|
|
758
753
|
|
|
759
754
|
topic = "mastermeid"
|
|
@@ -762,8 +757,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
762
757
|
ipcInterfaceName = "android.os.IQInternalService"
|
|
763
758
|
ipcTransactionID = 7
|
|
764
759
|
requestID = str(uuid.uuid4())
|
|
765
|
-
remoteMacAddress = self.settings.random_mac
|
|
766
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
760
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
761
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
767
762
|
|
|
768
763
|
payload = {
|
|
769
764
|
"eventName": eventName,
|
|
@@ -783,7 +778,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
783
778
|
LOGGER.debug("MQTT: Receiving ui_delay command")
|
|
784
779
|
|
|
785
780
|
async def command_disarm(self, partition_id: str, user_code: str = "", silent_disarming: bool = False) -> bool:
|
|
786
|
-
partition = self.state.partition(partition_id)
|
|
781
|
+
partition = self._controller.state.partition(partition_id)
|
|
787
782
|
if not partition:
|
|
788
783
|
LOGGER.debug("MQTT: disarm command error - Unknow Partition")
|
|
789
784
|
return False
|
|
@@ -791,7 +786,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
791
786
|
# Do local user code verification
|
|
792
787
|
user_id = 1
|
|
793
788
|
if self.check_user_code_on_disarm:
|
|
794
|
-
user_id = self.panel.check_user(user_code)
|
|
789
|
+
user_id = self._controller.panel.check_user(user_code)
|
|
795
790
|
if user_id == -1:
|
|
796
791
|
LOGGER.debug("MQTT: disarm command error - user_code error")
|
|
797
792
|
return False
|
|
@@ -819,7 +814,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
819
814
|
"userID": user_id,
|
|
820
815
|
"partitionID": int(partition_id), # INT EXPECTED
|
|
821
816
|
"operation_source": 1,
|
|
822
|
-
"macAddress": self.settings.random_mac,
|
|
817
|
+
"macAddress": self._controller.settings.random_mac,
|
|
823
818
|
}
|
|
824
819
|
|
|
825
820
|
topic = "mastermeid"
|
|
@@ -828,8 +823,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
828
823
|
ipcInterfaceName = "android.os.IQInternalService"
|
|
829
824
|
ipcTransactionID = 7
|
|
830
825
|
requestID = str(uuid.uuid4())
|
|
831
|
-
remoteMacAddress = self.settings.random_mac
|
|
832
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
826
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
827
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
833
828
|
|
|
834
829
|
payload = {"eventName": eventName,
|
|
835
830
|
"ipcServiceName": ipcServiceName,
|
|
@@ -892,8 +887,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
892
887
|
ipcInterfaceName = "android.os.IQZwaveService"
|
|
893
888
|
ipcTransactionID = 47
|
|
894
889
|
requestID = str(uuid.uuid4())
|
|
895
|
-
remoteMacAddress = self.settings.random_mac
|
|
896
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
890
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
891
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
897
892
|
|
|
898
893
|
payload = {
|
|
899
894
|
"eventName": eventName,
|
|
@@ -945,8 +940,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
945
940
|
ipcInterfaceName = "android.os.IQZwaveService"
|
|
946
941
|
ipcTransactionID = 47
|
|
947
942
|
requestID = str(uuid.uuid4())
|
|
948
|
-
remoteMacAddress = self.settings.random_mac
|
|
949
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
943
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
944
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
950
945
|
|
|
951
946
|
payload = {"eventName": eventName,
|
|
952
947
|
"ipcServiceName": ipcServiceName,
|
|
@@ -996,8 +991,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
996
991
|
ipcInterfaceName = "android.os.IQZwaveService"
|
|
997
992
|
ipcTransactionID = 47
|
|
998
993
|
requestID = str(uuid.uuid4())
|
|
999
|
-
remoteMacAddress = self.settings.random_mac
|
|
1000
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
994
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
995
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
1001
996
|
|
|
1002
997
|
payload = {
|
|
1003
998
|
"eventName": eventName,
|
|
@@ -1049,8 +1044,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1049
1044
|
ipcInterfaceName = "android.os.IQZwaveService"
|
|
1050
1045
|
ipcTransactionID = 47
|
|
1051
1046
|
requestID = str(uuid.uuid4())
|
|
1052
|
-
remoteMacAddress = self.settings.random_mac
|
|
1053
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
1047
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
1048
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
1054
1049
|
|
|
1055
1050
|
payload = {"eventName": eventName,
|
|
1056
1051
|
"ipcServiceName": ipcServiceName,
|
|
@@ -1099,8 +1094,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1099
1094
|
ipcInterfaceName = "android.os.IQZwaveService"
|
|
1100
1095
|
ipcTransactionID = 47
|
|
1101
1096
|
requestID = str(uuid.uuid4())
|
|
1102
|
-
remoteMacAddress = self.settings.random_mac
|
|
1103
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
1097
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
1098
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
1104
1099
|
|
|
1105
1100
|
payload = {"eventName": eventName,
|
|
1106
1101
|
"ipcServiceName": ipcServiceName,
|
|
@@ -1153,8 +1148,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1153
1148
|
ipcInterfaceName = "android.os.IQZwaveService"
|
|
1154
1149
|
ipcTransactionID = 47
|
|
1155
1150
|
requestID = str(uuid.uuid4())
|
|
1156
|
-
remoteMacAddress = self.settings.random_mac
|
|
1157
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
1151
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
1152
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
1158
1153
|
|
|
1159
1154
|
payload = {"eventName": eventName,
|
|
1160
1155
|
"ipcServiceName": ipcServiceName,
|
|
@@ -1177,14 +1172,14 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1177
1172
|
|
|
1178
1173
|
user_id = 0
|
|
1179
1174
|
|
|
1180
|
-
partition = self.state.partition(partition_id)
|
|
1175
|
+
partition = self._controller.state.partition(partition_id)
|
|
1181
1176
|
if not partition:
|
|
1182
1177
|
LOGGER.debug("MQTT: arm command error - Unknow Partition")
|
|
1183
1178
|
return False
|
|
1184
1179
|
|
|
1185
|
-
if self.panel.SECURE_ARMING == "true" and self.check_user_code_on_arm:
|
|
1180
|
+
if self._controller.panel.SECURE_ARMING == "true" and self.check_user_code_on_arm:
|
|
1186
1181
|
# Do local user code verification to arm if secure arming is enabled
|
|
1187
|
-
user_id = self.panel.check_user(user_code)
|
|
1182
|
+
user_id = self._controller.panel.check_user(user_code)
|
|
1188
1183
|
if user_id == -1:
|
|
1189
1184
|
LOGGER.debug("MQTT: arm command error - user_code error")
|
|
1190
1185
|
return False
|
|
@@ -1224,7 +1219,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1224
1219
|
"final_exit_arming_selected": False,
|
|
1225
1220
|
"manually_selected_zones": "[]",
|
|
1226
1221
|
"operation_source": 1,
|
|
1227
|
-
"macAddress": self.settings.random_mac,
|
|
1222
|
+
"macAddress": self._controller.settings.random_mac,
|
|
1228
1223
|
}
|
|
1229
1224
|
|
|
1230
1225
|
topic = "mastermeid"
|
|
@@ -1233,8 +1228,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1233
1228
|
ipcInterfaceName = "android.os.IQInternalService"
|
|
1234
1229
|
ipcTransactionID = 7
|
|
1235
1230
|
requestID = str(uuid.uuid4())
|
|
1236
|
-
remoteMacAddress = self.settings.random_mac
|
|
1237
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
1231
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
1232
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
1238
1233
|
|
|
1239
1234
|
payload = {
|
|
1240
1235
|
"eventName": eventName,
|
|
@@ -1257,7 +1252,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1257
1252
|
async def command_execute_scene(self,scene_id:str) -> bool:
|
|
1258
1253
|
LOGGER.debug("MQTT: Sending execute_scene command")
|
|
1259
1254
|
|
|
1260
|
-
scene = self.state.scene(scene_id)
|
|
1255
|
+
scene = self._controller.state.scene(scene_id)
|
|
1261
1256
|
if not scene:
|
|
1262
1257
|
LOGGER.debug("MQTT: command_execute_scene Erro - Unknow Scene: %s", scene_id)
|
|
1263
1258
|
return False
|
|
@@ -1266,7 +1261,7 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1266
1261
|
"operation_name": "execute_scene",
|
|
1267
1262
|
"scene_id": scene.scene_id,
|
|
1268
1263
|
"operation_source": 1,
|
|
1269
|
-
"macAddress": self.settings.random_mac,
|
|
1264
|
+
"macAddress": self._controller.settings.random_mac,
|
|
1270
1265
|
}
|
|
1271
1266
|
|
|
1272
1267
|
topic = "mastermeid"
|
|
@@ -1275,8 +1270,8 @@ class QolsysPluginRemote(QolsysPlugin):
|
|
|
1275
1270
|
ipcInterfaceName = "android.os.IQInternalService"
|
|
1276
1271
|
ipcTransactionID = 7
|
|
1277
1272
|
requestID = str(uuid.uuid4())
|
|
1278
|
-
remoteMacAddress = self.settings.random_mac
|
|
1279
|
-
responseTopic = "response_" + self.settings.random_mac
|
|
1273
|
+
remoteMacAddress = self._controller.settings.random_mac
|
|
1274
|
+
responseTopic = "response_" + self._controller.settings.random_mac
|
|
1280
1275
|
|
|
1281
1276
|
payload = {
|
|
1282
1277
|
"eventName": eventName,
|