qolsys-controller 0.0.2__py3-none-any.whl → 0.0.4__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.
- qolsys_controller/controller.py +6 -8
- qolsys_controller/database/db.py +62 -58
- qolsys_controller/database/table.py +24 -25
- qolsys_controller/database/table_alarmedsensor.py +15 -14
- qolsys_controller/database/table_automation.py +32 -28
- qolsys_controller/database/table_country_locale.py +23 -20
- qolsys_controller/database/table_dashboard_msgs.py +6 -5
- qolsys_controller/database/table_dimmerlight.py +22 -20
- qolsys_controller/database/table_doorlock.py +22 -20
- qolsys_controller/database/table_eu_event.py +5 -5
- qolsys_controller/database/table_heat_map.py +14 -13
- qolsys_controller/database/table_history.py +16 -15
- qolsys_controller/database/table_iqremotesettings.py +13 -12
- qolsys_controller/database/table_iqrouter_network_config.py +5 -5
- qolsys_controller/database/table_iqrouter_user_device.py +5 -5
- qolsys_controller/database/table_master_slave.py +28 -25
- qolsys_controller/database/table_partition.py +10 -10
- qolsys_controller/database/table_powerg_device.py +5 -5
- qolsys_controller/database/table_qolsyssettings.py +10 -10
- qolsys_controller/database/table_scene.py +20 -17
- qolsys_controller/database/table_sensor.py +56 -47
- qolsys_controller/database/table_smartsocket.py +5 -5
- qolsys_controller/database/table_state.py +12 -11
- qolsys_controller/database/table_tcc.py +6 -5
- qolsys_controller/database/table_thermostat.py +41 -34
- qolsys_controller/database/table_trouble_conditions.py +14 -13
- qolsys_controller/database/table_user.py +17 -16
- qolsys_controller/database/table_virtual_device.py +5 -5
- qolsys_controller/database/table_weather.py +16 -15
- qolsys_controller/database/table_zigbee_device.py +5 -5
- qolsys_controller/database/table_zwave_association_group.py +19 -17
- qolsys_controller/database/table_zwave_history.py +22 -20
- qolsys_controller/database/table_zwave_node.py +73 -68
- qolsys_controller/database/table_zwave_other.py +5 -5
- qolsys_controller/enum.py +44 -41
- qolsys_controller/errors.py +13 -13
- qolsys_controller/mdns.py +3 -3
- qolsys_controller/mqtt_command_queue.py +2 -3
- qolsys_controller/observable.py +3 -2
- qolsys_controller/panel.py +147 -146
- qolsys_controller/partition.py +46 -43
- qolsys_controller/pki.py +72 -65
- qolsys_controller/plugin.py +5 -4
- qolsys_controller/plugin_c4.py +8 -9
- qolsys_controller/plugin_remote.py +237 -228
- qolsys_controller/settings.py +75 -8
- qolsys_controller/state.py +68 -65
- qolsys_controller/task_manager.py +3 -3
- qolsys_controller/utils_mqtt.py +14 -11
- qolsys_controller/zone.py +69 -68
- qolsys_controller/zwave_device.py +46 -43
- qolsys_controller/zwave_dimmer.py +28 -26
- qolsys_controller/zwave_garagedoor.py +1 -0
- qolsys_controller/zwave_generic.py +2 -1
- qolsys_controller/zwave_lock.py +28 -30
- qolsys_controller/zwave_outlet.py +1 -0
- qolsys_controller/zwave_thermostat.py +58 -55
- {qolsys_controller-0.0.2.dist-info → qolsys_controller-0.0.4.dist-info}/METADATA +1 -1
- qolsys_controller-0.0.4.dist-info/RECORD +62 -0
- qolsys_controller-0.0.2.dist-info/RECORD +0 -62
- {qolsys_controller-0.0.2.dist-info → qolsys_controller-0.0.4.dist-info}/WHEEL +0 -0
- {qolsys_controller-0.0.2.dist-info → qolsys_controller-0.0.4.dist-info}/licenses/LICENSE +0 -0
qolsys_controller/panel.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
import json
|
2
2
|
import logging
|
3
|
-
from datetime import datetime
|
4
|
-
from pathlib import Path
|
5
3
|
|
6
4
|
from .database.db import QolsysDB
|
7
5
|
from .enum import (
|
@@ -11,6 +9,7 @@ from .enum import (
|
|
11
9
|
)
|
12
10
|
from .observable import QolsysObservable
|
13
11
|
from .partition import QolsysPartition
|
12
|
+
from .settings import QolsysSettings
|
14
13
|
from .state import QolsysState
|
15
14
|
from .zone import QolsysZone
|
16
15
|
from .zwave_device import QolsysZWaveDevice
|
@@ -21,26 +20,31 @@ from .zwave_thermostat import QolsysThermostat
|
|
21
20
|
|
22
21
|
LOGGER = logging.getLogger(__name__)
|
23
22
|
|
23
|
+
|
24
24
|
class QolsysPanel(QolsysObservable):
|
25
|
-
def __init__(self,
|
25
|
+
def __init__(self, settings: QolsysSettings, state: QolsysState) -> None:
|
26
26
|
|
27
27
|
self._state = state
|
28
|
+
self._settings = settings
|
28
29
|
self._db = QolsysDB()
|
29
30
|
|
30
31
|
# Partition settings
|
31
|
-
self.settings_partition = ["SYSTEM_STATUS","EXIT_SOUNDS","ENTRY_DELAYS","SYSTEM_STATUS_CHANGED_TIME"]
|
32
|
+
self.settings_partition = ["SYSTEM_STATUS", "EXIT_SOUNDS", "ENTRY_DELAYS", "SYSTEM_STATUS_CHANGED_TIME"]
|
32
33
|
self.state_partition = ["ALARM_STATE"]
|
33
34
|
|
34
35
|
# Panel settings
|
35
36
|
self.settings_panel_observer = QolsysObservable()
|
36
|
-
self.settings_panel = [
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
self.settings_panel = [
|
38
|
+
"PANEL_TAMPER_STATE", "AC_STATUS", "BATTERY_STATUS", "FAIL_TO_COMMUNICATE", "SECURE_ARMING", "AUTO_BYPASS",
|
39
|
+
"AUTO_STAY", "AUTO_ARM_STAY", "AUTO_EXIT_EXTENSION", "FINAL_EXIT_DOOR_ARMING", "NO_ARM_LOW_BATTERY",
|
40
|
+
"TEMPFORMAT", "LANGUAGE", "COUNTRY", "SYSTEM_TIME", "GSM_CONNECTION_STATUS", "GSM_SIGNAL_STRENGTH",
|
41
|
+
"ANDROID_VERSION", "HARDWARE_VERSION", "TIMER_NORMAL_ENTRY_DELAY", "TIMER_NORMAL_EXIT_DELAY",
|
42
|
+
"TIMER_LONG_ENTRY_DELAY", "TIMER_LONG_EXIT_DELAY", "ZWAVE_CONTROLLER", "ZWAVE_CARD", "POLICE_PANIC_ENABLED",
|
43
|
+
"FIRE_PANIC_ENABLED", "AUXILIARY_PANIC_ENABLED", "NIGHTMODE_SETTINGS", "NIGHT_SETTINGS_STATE", "PARTITIONS",
|
44
|
+
"SIX_DIGIT_USER_CODE", "SHOW_SECURITY_SENSORS", "SYSTEM_LOGGED_IN_USER", "PANEL_SCENES_SETTING", "CONTROL_4",
|
45
|
+
"ZWAVE_FIRM_WARE_VERSION", "FINAL_EXIT_DOOR_ARMING", "NO_ARM_LOW_BATTERY", "MAC_ADDRESS",
|
46
|
+
"LAST_UPDATE_IQ_REMOTE_PATCH_CKECKSUM_N",
|
47
|
+
]
|
44
48
|
|
45
49
|
self._PANEL_TAMPER_STATE = ""
|
46
50
|
self._AC_STATUS = ""
|
@@ -84,7 +88,6 @@ class QolsysPanel(QolsysObservable):
|
|
84
88
|
|
85
89
|
self._users = []
|
86
90
|
self._unique_id = ""
|
87
|
-
self._settings_directory = settings_directory
|
88
91
|
|
89
92
|
self._imei = ""
|
90
93
|
self._product_type = ""
|
@@ -92,7 +95,7 @@ class QolsysPanel(QolsysObservable):
|
|
92
95
|
def read_users_file(self) -> bool:
|
93
96
|
# Loading user_code data from users.conf file
|
94
97
|
try:
|
95
|
-
path =
|
98
|
+
path = self._settings.users_file_path
|
96
99
|
with path.open("r", encoding="utf-8") as file:
|
97
100
|
try:
|
98
101
|
users = json.load(file)
|
@@ -284,26 +287,26 @@ class QolsysPanel(QolsysObservable):
|
|
284
287
|
return self._TIMER_LONG_ENTRY_DELAY
|
285
288
|
|
286
289
|
@property
|
287
|
-
def
|
290
|
+
def MAC_ADDRESS(self) -> str:
|
288
291
|
self._MAC_ADDRESS = self.db.get_setting_panel("MAC_ADDRESS")
|
289
292
|
return self._MAC_ADDRESS
|
290
293
|
|
291
294
|
@MAC_ADDRESS.setter
|
292
|
-
def MAC_ADDRESS(self, value:str) -> None:
|
295
|
+
def MAC_ADDRESS(self, value: str) -> None:
|
293
296
|
self._MAC_ADDRESS = value
|
294
297
|
|
295
298
|
@property
|
296
|
-
def unique_id(self)
|
299
|
+
def unique_id(self) -> str:
|
297
300
|
mac_address = self.MAC_ADDRESS
|
298
|
-
return mac_address.replace(":","")
|
301
|
+
return mac_address.replace(":", "")
|
299
302
|
|
300
303
|
@property
|
301
|
-
def TIMER_LONG_EXIT_DELAY(self) ->
|
304
|
+
def TIMER_LONG_EXIT_DELAY(self) -> str:
|
302
305
|
self._TIMER_LONG_EXIT_DELAY = self.db.get_setting_panel("TIMER_LONG_ENTRY_DELAY")
|
303
306
|
return self._TIMER_LONG_EXIT_DELAY
|
304
307
|
|
305
308
|
@property
|
306
|
-
def LAST_UPDATE_IQ_REMOTE_PATCH_CKECKSUM_N(self) -> str
|
309
|
+
def LAST_UPDATE_IQ_REMOTE_PATCH_CKECKSUM_N(self) -> str:
|
307
310
|
self._LAST_UPDATE_IQ_REMOTE_PATCH_CKECKSUM_N = self.db.get_setting_panel("LAST_UPDATE_IQ_REMOTE_PATCH_CKECKSUM_N")
|
308
311
|
return self._LAST_UPDATE_IQ_REMOTE_PATCH_CKECKSUM_N
|
309
312
|
|
@@ -312,7 +315,7 @@ class QolsysPanel(QolsysObservable):
|
|
312
315
|
return self._imei
|
313
316
|
|
314
317
|
@imei.setter
|
315
|
-
def imei(self,value:str) -> None:
|
318
|
+
def imei(self, value: str) -> None:
|
316
319
|
self._imei = value
|
317
320
|
|
318
321
|
@property
|
@@ -320,7 +323,7 @@ class QolsysPanel(QolsysObservable):
|
|
320
323
|
return self._product_type
|
321
324
|
|
322
325
|
@product_type.setter
|
323
|
-
def product_type(self,value:str) -> None:
|
326
|
+
def product_type(self, value: str) -> None:
|
324
327
|
self._product_type = value
|
325
328
|
|
326
329
|
@property
|
@@ -329,7 +332,7 @@ class QolsysPanel(QolsysObservable):
|
|
329
332
|
return self._SYSTEM_LOGGED_IN_USER
|
330
333
|
|
331
334
|
@SYSTEM_LOGGED_IN_USER.setter
|
332
|
-
def SYSTEM_LOGGED_IN_USER(self,value:str) -> None:
|
335
|
+
def SYSTEM_LOGGED_IN_USER(self, value: str) -> None:
|
333
336
|
self._SYSTEM_LOGGED_IN_USER = value
|
334
337
|
|
335
338
|
@property
|
@@ -337,14 +340,14 @@ class QolsysPanel(QolsysObservable):
|
|
337
340
|
self._PANEL_SCENES_SETTING = self.db.get_setting_panel("PANEL_SCENES_SETTING")
|
338
341
|
return self.PANEL_SCENES_SETTING
|
339
342
|
|
340
|
-
def load_database(self,database:dict) -> None:
|
343
|
+
def load_database(self, database: dict) -> None:
|
341
344
|
self.db.load_db(database)
|
342
345
|
self._state.sync_partitions_data(self.get_partitions_from_db())
|
343
346
|
self._state.sync_zones_data(self.get_zones_from_db())
|
344
347
|
self._state.sync_zwave_devices_data(self.get_zwave_devices_from_db())
|
345
348
|
|
346
349
|
# Parse panel update to database
|
347
|
-
def parse_iq2meid_message(self,data:dict) -> bool: # noqa: C901, PLR0912, PLR0915
|
350
|
+
def parse_iq2meid_message(self, data: dict) -> bool: # noqa: C901, PLR0912, PLR0915
|
348
351
|
|
349
352
|
eventName = data.get("eventName")
|
350
353
|
dbOperation = data.get("dbOperation")
|
@@ -368,22 +371,22 @@ class QolsysPanel(QolsysObservable):
|
|
368
371
|
|
369
372
|
# Update Settings Content Provider
|
370
373
|
case self.db.table_qolsyssettings.uri:
|
371
|
-
name = content_values.get("name","")
|
372
|
-
new_value = content_values.get("value","")
|
374
|
+
name = content_values.get("name", "")
|
375
|
+
new_value = content_values.get("value", "")
|
373
376
|
old_value = self.db.get_setting_panel(name)
|
374
|
-
self.db.table_qolsyssettings.update(selection,selection_argument,content_values)
|
377
|
+
self.db.table_qolsyssettings.update(selection, selection_argument, content_values)
|
375
378
|
|
376
379
|
# Update Panel Settings - Send notification if settings ha changed
|
377
380
|
if name in self.settings_panel and old_value != new_value:
|
378
|
-
LOGGER.debug("Panel Setting - %s: %s",name,new_value)
|
381
|
+
LOGGER.debug("Panel Setting - %s: %s", name, new_value)
|
379
382
|
self.settings_panel_observer.notify()
|
380
383
|
|
381
384
|
# Update Partition setting - Send notification if setting has changed
|
382
385
|
if name in self.settings_partition:
|
383
|
-
partition_id = content_values.get("partition_id","")
|
386
|
+
partition_id = content_values.get("partition_id", "")
|
384
387
|
partition = self._state.partition(partition_id)
|
385
388
|
if partition is not None:
|
386
|
-
|
389
|
+
match name:
|
387
390
|
case "SYSTEM_STATUS":
|
388
391
|
partition.system_status = PartitionSystemStatus(new_value)
|
389
392
|
case "SYSTEM_STATUS_CHANGED_TIME":
|
@@ -395,18 +398,18 @@ class QolsysPanel(QolsysObservable):
|
|
395
398
|
|
396
399
|
# Update Sensor Content Provider
|
397
400
|
case self.db.table_sensor.uri:
|
398
|
-
self.db.table_sensor.update(selection,selection_argument,content_values)
|
399
|
-
zoneid =
|
401
|
+
self.db.table_sensor.update(selection, selection_argument, content_values)
|
402
|
+
zoneid = content_values.get("zoneid", "")
|
400
403
|
zone = self._state.zone(zoneid)
|
401
404
|
if zone is not None:
|
402
405
|
zone.update(content_values)
|
403
406
|
|
404
407
|
# Update State
|
405
408
|
case self.db.table_state.uri:
|
406
|
-
name = content_values.get("name","")
|
407
|
-
new_value = content_values.get("value","")
|
408
|
-
partition_id = content_values.get("partition_id","")
|
409
|
-
self.db.table_state.update(selection,selection_argument,content_values)
|
409
|
+
name = content_values.get("name", "")
|
410
|
+
new_value = content_values.get("value", "")
|
411
|
+
partition_id = content_values.get("partition_id", "")
|
412
|
+
self.db.table_state.update(selection, selection_argument, content_values)
|
410
413
|
|
411
414
|
if name in self.state_partition:
|
412
415
|
partition = self._state.partition(partition_id)
|
@@ -417,85 +420,85 @@ class QolsysPanel(QolsysObservable):
|
|
417
420
|
|
418
421
|
# Update heat_map
|
419
422
|
case self.db.table_heat_map.uri:
|
420
|
-
self.db.table_heat_map.update(selection,selection_argument,content_values)
|
423
|
+
self.db.table_heat_map.update(selection, selection_argument, content_values)
|
421
424
|
# No action needed
|
422
425
|
|
423
426
|
# Update master_slave
|
424
427
|
case self.db.table_master_slave.uri:
|
425
|
-
self.db.table_master_slave.update(selection,selection_argument,content_values)
|
428
|
+
self.db.table_master_slave.update(selection, selection_argument, content_values)
|
426
429
|
# No action needed
|
427
430
|
|
428
431
|
# Update dashboard_msgs
|
429
432
|
case self.db.table_dashboard_msgs.uri:
|
430
|
-
self.db.table_dashboard_msgs.update(selection,selection_argument,content_values)
|
433
|
+
self.db.table_dashboard_msgs.update(selection, selection_argument, content_values)
|
431
434
|
# No action needed
|
432
435
|
|
433
436
|
# Update PartitionContentProvider
|
434
437
|
case self.db.table_partition.uri:
|
435
|
-
self.db.table_partition.update(selection,selection_argument,content_values)
|
436
|
-
partition_id = content_values.get("partition_id","")
|
438
|
+
self.db.table_partition.update(selection, selection_argument, content_values)
|
439
|
+
partition_id = content_values.get("partition_id", "")
|
437
440
|
partition = self._state.partition(partition_id)
|
438
441
|
if partition is not None:
|
439
442
|
partition.update_partition(content_values)
|
440
443
|
|
441
444
|
# Update History Content Provider
|
442
445
|
case self.db.table_history.uri:
|
443
|
-
self.db.table_history.update(selection,selection_argument,content_values)
|
446
|
+
self.db.table_history.update(selection, selection_argument, content_values)
|
444
447
|
# No action needed
|
445
448
|
|
446
449
|
# Update DimmerLightsContentProvider
|
447
450
|
case self.db.table_dimmer.uri:
|
448
|
-
self.db.table_dimmer.update(selection,selection_argument,content_values)
|
449
|
-
node_id =
|
451
|
+
self.db.table_dimmer.update(selection, selection_argument, content_values)
|
452
|
+
node_id = content_values.get("node_id", "")
|
450
453
|
node = self._state.zwave_device(node_id)
|
451
|
-
if node is not None and isinstance(node,QolsysDimmer):
|
454
|
+
if node is not None and isinstance(node, QolsysDimmer):
|
452
455
|
node.update_dimmer(content_values)
|
453
456
|
|
454
457
|
# Update Thermostat Content Provider
|
455
458
|
case self.db.table_thermostat.uri:
|
456
|
-
self.db.table_thermostat.update(selection,selection_argument,content_values)
|
457
|
-
node_id =
|
459
|
+
self.db.table_thermostat.update(selection, selection_argument, content_values)
|
460
|
+
node_id = content_values.get("node_id", "")
|
458
461
|
node = self._state.zwave_device(node_id)
|
459
|
-
if node is not None and isinstance(node,QolsysThermostat):
|
462
|
+
if node is not None and isinstance(node, QolsysThermostat):
|
460
463
|
node.update_thermostat(content_values)
|
461
464
|
|
462
465
|
# Update DoorLockContentProvider
|
463
466
|
case self.db.table_doorlock.uri:
|
464
|
-
self.db.table_doorlock.update(selection,selection_argument,content_values)
|
465
|
-
node_id =
|
467
|
+
self.db.table_doorlock.update(selection, selection_argument, content_values)
|
468
|
+
node_id = content_values.get("node_id", "")
|
466
469
|
node = self._state.zwave_device(node_id)
|
467
|
-
if node is not None and isinstance(node,QolsysLock):
|
470
|
+
if node is not None and isinstance(node, QolsysLock):
|
468
471
|
node.update_lock(content_values)
|
469
472
|
|
470
473
|
# Update ZwaveContentProvider
|
471
474
|
case self.db.table_zwave_node.uri:
|
472
|
-
self.db.table_zwave_node.update(selection,selection_argument,content_values)
|
473
|
-
node_id =
|
475
|
+
self.db.table_zwave_node.update(selection, selection_argument, content_values)
|
476
|
+
node_id = content_values.get("node_id", "")
|
474
477
|
node = self._state.zwave_device(node_id)
|
475
478
|
if node is not None:
|
476
479
|
node.update_base(content_values)
|
477
480
|
|
478
481
|
# Update Z-Wave History Content Provier
|
479
482
|
case self.db.table_zwave_history.uri:
|
480
|
-
self.db.table_zwave_history.update(selection,selection_argument,content_values)
|
483
|
+
self.db.table_zwave_history.update(selection, selection_argument, content_values)
|
481
484
|
# No action needed
|
482
485
|
|
483
486
|
# Update AutomationDeviceContentProvider
|
484
487
|
case self.db.table_automation.uri:
|
485
|
-
self.db.table_automation.update(selection,selection_argument,content_values)
|
488
|
+
self.db.table_automation.update(selection, selection_argument, content_values)
|
486
489
|
# No action needed
|
487
490
|
|
488
491
|
# Update Alarmed Sensor Content Provider
|
489
492
|
case self.db.table_alarmedsensor.uri:
|
490
|
-
self.db.table_alarmedsensor.update(selection,selection_argument,content_values)
|
493
|
+
self.db.table_alarmedsensor.update(selection, selection_argument, content_values)
|
491
494
|
|
492
495
|
# Update IQ Remote Settings Content Provider
|
493
496
|
case self.db.table_iqremotesettings.uri:
|
494
|
-
self.db.table_iqremotesettings.update(selection,selection_argument,content_values)
|
497
|
+
self.db.table_iqremotesettings.update(selection, selection_argument, content_values)
|
495
498
|
# No action needed
|
496
499
|
|
497
500
|
case _:
|
498
|
-
LOGGER.debug("iq2meid updating unknow uri:%s",uri)
|
501
|
+
LOGGER.debug("iq2meid updating unknow uri:%s", uri)
|
499
502
|
LOGGER.debug(data)
|
500
503
|
|
501
504
|
case "delete":
|
@@ -505,72 +508,72 @@ class QolsysPanel(QolsysObservable):
|
|
505
508
|
match uri:
|
506
509
|
|
507
510
|
case self.db.table_sensor.uri:
|
508
|
-
self.db.table_sensor.delete(selection,selection_argument)
|
511
|
+
self.db.table_sensor.delete(selection, selection_argument)
|
509
512
|
self._state.sync_zones_data(self.get_zones_from_db())
|
510
513
|
# Notify delete zone
|
511
514
|
|
512
515
|
case self.db.table_iqremotesettings.uri:
|
513
|
-
self.db.table_iqremotesettings.delete(selection,selection_argument)
|
516
|
+
self.db.table_iqremotesettings.delete(selection, selection_argument)
|
514
517
|
# No action needed
|
515
518
|
|
516
519
|
case self.db.table_state.uri:
|
517
|
-
self.db.table_state.delete(selection,selection_argument)
|
520
|
+
self.db.table_state.delete(selection, selection_argument)
|
518
521
|
# No action needed
|
519
522
|
|
520
523
|
case self.db.table_master_slave.uri:
|
521
|
-
self.db.table_master_slave.delete(selection,selection_argument)
|
524
|
+
self.db.table_master_slave.delete(selection, selection_argument)
|
522
525
|
# No action needed
|
523
526
|
|
524
527
|
case self.db.table_qolsyssettings.uri:
|
525
|
-
self.db.table_qolsyssettings.delete(selection,selection_argument)
|
528
|
+
self.db.table_qolsyssettings.delete(selection, selection_argument)
|
526
529
|
# No action needed
|
527
530
|
|
528
531
|
case self.db.table_alarmedsensor.uri:
|
529
|
-
self.db.table_alarmedsensor.delete(selection,selection_argument)
|
532
|
+
self.db.table_alarmedsensor.delete(selection, selection_argument)
|
530
533
|
self._state.sync_partitions_data(self.get_partitions_from_db())
|
531
534
|
|
532
535
|
case self.db.table_history.uri:
|
533
|
-
self.db.table_history.delete(selection,selection_argument)
|
536
|
+
self.db.table_history.delete(selection, selection_argument)
|
534
537
|
# No action needed
|
535
538
|
|
536
539
|
case self.db.table_zwave_history.uri:
|
537
|
-
self.db.table_zwave_history.delete(selection,selection_argument)
|
540
|
+
self.db.table_zwave_history.delete(selection, selection_argument)
|
538
541
|
# No action needed
|
539
542
|
|
540
543
|
case self.db.table_doorlock.uri:
|
541
|
-
self.db.table_doorlock.delete(selection,selection_argument)
|
544
|
+
self.db.table_doorlock.delete(selection, selection_argument)
|
542
545
|
self._state.sync_zwave_devices_data(self.get_zwave_devices_from_db())
|
543
546
|
|
544
547
|
case self.db.table_dimmer.uri:
|
545
|
-
self.db.table_dimmer.delete(selection,selection_argument)
|
548
|
+
self.db.table_dimmer.delete(selection, selection_argument)
|
546
549
|
self._state.sync_zwave_devices_data(self.get_zwave_devices_from_db())
|
547
550
|
|
548
551
|
case self.db.table_thermostat.uri:
|
549
|
-
self.db.table_thermostat.delete(selection,selection_argument)
|
552
|
+
self.db.table_thermostat.delete(selection, selection_argument)
|
550
553
|
self._state.sync_zwave_devices_data(self.get_zwave_devices_from_db())
|
551
554
|
|
552
555
|
case self.db.table_zwave_node.uri:
|
553
|
-
self.db.table_zwave_node.delete(selection,selection_argument)
|
556
|
+
self.db.table_zwave_node.delete(selection, selection_argument)
|
554
557
|
self._state.sync_zwave_devices_data(self.get_zwave_devices_from_db())
|
555
558
|
|
556
559
|
case self.db.table_automation.uri:
|
557
|
-
self.db.table_automation.delete(selection,selection_argument)
|
560
|
+
self.db.table_automation.delete(selection, selection_argument)
|
558
561
|
# No action needed
|
559
562
|
|
560
563
|
case self.db.table_partition.uri:
|
561
|
-
self.db.table_partition.delete(selection,selection_argument)
|
564
|
+
self.db.table_partition.delete(selection, selection_argument)
|
562
565
|
self._state.sync_partitions_data(self.get_partitions_from_db())
|
563
566
|
|
564
567
|
case self.db.table_user.uri:
|
565
|
-
self.db.table_user.delete(selection,selection_argument)
|
568
|
+
self.db.table_user.delete(selection, selection_argument)
|
566
569
|
# No action needed
|
567
570
|
|
568
571
|
case self.db.table_dashboard_msgs.uri:
|
569
|
-
self.db.table_dashboard_msgs.delete(selection,selection_argument)
|
572
|
+
self.db.table_dashboard_msgs.delete(selection, selection_argument)
|
570
573
|
# No action needed
|
571
574
|
|
572
575
|
case _:
|
573
|
-
LOGGER.debug("iq2meid deleting unknown uri:%s",uri)
|
576
|
+
LOGGER.debug("iq2meid deleting unknown uri:%s", uri)
|
574
577
|
LOGGER.debug(data)
|
575
578
|
|
576
579
|
case "insert":
|
@@ -582,10 +585,10 @@ class QolsysPanel(QolsysObservable):
|
|
582
585
|
case self.db.table_state.uri:
|
583
586
|
self.db.table_state.insert(data=content_values)
|
584
587
|
|
585
|
-
name = content_values.get("name","")
|
586
|
-
new_value = content_values.get("value","")
|
588
|
+
name = content_values.get("name", "")
|
589
|
+
new_value = content_values.get("value", "")
|
587
590
|
if name in self.state_partition:
|
588
|
-
partition_id = content_values.get("partition_id","")
|
591
|
+
partition_id = content_values.get("partition_id", "")
|
589
592
|
partition = self._state.partition(partition_id)
|
590
593
|
if partition is not None:
|
591
594
|
match name:
|
@@ -602,13 +605,13 @@ class QolsysPanel(QolsysObservable):
|
|
602
605
|
self.db.table_qolsyssettings.insert(data=content_values)
|
603
606
|
|
604
607
|
# Update Partition setting - Send notification if setting has changed
|
605
|
-
name = content_values.get("name","")
|
606
|
-
new_value = content_values.get("value","")
|
608
|
+
name = content_values.get("name", "")
|
609
|
+
new_value = content_values.get("value", "")
|
607
610
|
if name in self.settings_partition:
|
608
|
-
partition_id = content_values.get("partition_id","")
|
611
|
+
partition_id = content_values.get("partition_id", "")
|
609
612
|
partition = self._state.partition(partition_id)
|
610
613
|
if partition is not None:
|
611
|
-
|
614
|
+
match name:
|
612
615
|
case "SYSTEM_STATUS":
|
613
616
|
partition.system_status = PartitionSystemStatus(new_value)
|
614
617
|
case "SYSTEM_STATUS_CHANGED_TIME":
|
@@ -653,7 +656,7 @@ class QolsysPanel(QolsysObservable):
|
|
653
656
|
self.db.table_thermostat.insert(data=content_values)
|
654
657
|
self._state.sync_zwave_devices_data(self.get_zwave_devices_from_db())
|
655
658
|
|
656
|
-
#ZWave Node Content Provider
|
659
|
+
# ZWave Node Content Provider
|
657
660
|
case self.db.table_zwave_node.uri:
|
658
661
|
self.db.table_zwave_node.insert(data=content_values)
|
659
662
|
self._state.sync_zwave_devices_data(self.get_zwave_devices_from_db())
|
@@ -666,12 +669,12 @@ class QolsysPanel(QolsysObservable):
|
|
666
669
|
# AlarmedSensorProvider
|
667
670
|
case self.db.table_alarmedsensor.uri:
|
668
671
|
|
669
|
-
partition_id = content_values.get("partition_id","")
|
672
|
+
partition_id = content_values.get("partition_id", "")
|
670
673
|
self.db.table_alarmedsensor.insert(data=content_values)
|
671
674
|
|
672
675
|
partition = self._state.partition(partition_id)
|
673
676
|
if partition is not None:
|
674
|
-
partition.append_alarm_type([PartitionAlarmType(content_values.get("sgroup",""))])
|
677
|
+
partition.append_alarm_type([PartitionAlarmType(content_values.get("sgroup", ""))])
|
675
678
|
|
676
679
|
# IQRemoteSettingsProvider
|
677
680
|
case self.db.table_iqremotesettings.uri:
|
@@ -693,19 +696,18 @@ class QolsysPanel(QolsysObservable):
|
|
693
696
|
self.db.table_dashboard_msgs.insert(data=content_values)
|
694
697
|
# No action needed
|
695
698
|
|
696
|
-
|
697
699
|
case _:
|
698
|
-
LOGGER.debug("iq2meid inserting unknow uri:%s",uri)
|
700
|
+
LOGGER.debug("iq2meid inserting unknow uri:%s", uri)
|
699
701
|
LOGGER.debug(data)
|
700
702
|
|
701
703
|
case _:
|
702
|
-
LOGGER.debug("iq2meid - Unknow dboperation: %s",dbOperation)
|
704
|
+
LOGGER.debug("iq2meid - Unknow dboperation: %s", dbOperation)
|
703
705
|
LOGGER.debug(data)
|
704
706
|
case _:
|
705
|
-
LOGGER.debug("iq2meid - Unknow event: %s",eventName)
|
707
|
+
LOGGER.debug("iq2meid - Unknow event: %s", eventName)
|
706
708
|
LOGGER.debug(data)
|
707
709
|
|
708
|
-
def check_user(self,user_code:str) -> int:
|
710
|
+
def check_user(self, user_code: str) -> int:
|
709
711
|
for user in self._users:
|
710
712
|
if user["user_code"] == user_code:
|
711
713
|
return user["id"]
|
@@ -724,36 +726,36 @@ class QolsysPanel(QolsysObservable):
|
|
724
726
|
|
725
727
|
device_added = False
|
726
728
|
|
727
|
-
zwave_node_id = device.get("node_id","")
|
729
|
+
zwave_node_id = device.get("node_id", "")
|
728
730
|
# Check if z-wave device is a Dimmer
|
729
731
|
for d in dimmers_list:
|
730
|
-
dimmer_node_id = d.get("node_id","")
|
732
|
+
dimmer_node_id = d.get("node_id", "")
|
731
733
|
|
732
734
|
# Found a Dimmer
|
733
735
|
if zwave_node_id == dimmer_node_id:
|
734
|
-
qolsys_dimmer = QolsysDimmer(d,device)
|
736
|
+
qolsys_dimmer = QolsysDimmer(d, device)
|
735
737
|
devices.append(qolsys_dimmer)
|
736
738
|
device_added = True
|
737
739
|
break
|
738
740
|
|
739
741
|
# Check is z-wave devie is a Thermostat
|
740
742
|
for thermostat in thermostats_list:
|
741
|
-
thermostat_node_id = thermostat.get("node_id","")
|
743
|
+
thermostat_node_id = thermostat.get("node_id", "")
|
742
744
|
|
743
745
|
# Found a Thermostat
|
744
746
|
if zwave_node_id == thermostat_node_id:
|
745
|
-
qolsys_thermostat = QolsysThermostat(thermostat,device)
|
747
|
+
qolsys_thermostat = QolsysThermostat(thermostat, device)
|
746
748
|
devices.append(qolsys_thermostat)
|
747
749
|
device_added = True
|
748
750
|
break
|
749
751
|
|
750
752
|
# Check is z-wave device is a Lock
|
751
753
|
for lock in locks_list:
|
752
|
-
lock_node_id = lock.get("node_id","")
|
754
|
+
lock_node_id = lock.get("node_id", "")
|
753
755
|
|
754
756
|
# Found a Lock
|
755
757
|
if zwave_node_id == lock_node_id:
|
756
|
-
qolsys_lock = QolsysLock(lock,device)
|
758
|
+
qolsys_lock = QolsysLock(lock, device)
|
757
759
|
devices.append(qolsys_lock)
|
758
760
|
device_added = True
|
759
761
|
break
|
@@ -771,9 +773,9 @@ class QolsysPanel(QolsysObservable):
|
|
771
773
|
|
772
774
|
def get_zones_from_db(self) -> list[QolsysZone]:
|
773
775
|
zones = []
|
774
|
-
zones_list:list[dict] = self.db.get_zones()
|
776
|
+
zones_list: list[dict] = self.db.get_zones()
|
775
777
|
|
776
|
-
|
778
|
+
# Create sensors array
|
777
779
|
for zone_info in zones_list:
|
778
780
|
zones.append(QolsysZone(zone_info))
|
779
781
|
|
@@ -782,7 +784,7 @@ class QolsysPanel(QolsysObservable):
|
|
782
784
|
def get_partitions_from_db(self) -> list[QolsysPartition]:
|
783
785
|
|
784
786
|
partitions = []
|
785
|
-
partition_list:list[dict] = self.db.get_partitions()
|
787
|
+
partition_list: list[dict] = self.db.get_partitions()
|
786
788
|
|
787
789
|
# Create partitions array
|
788
790
|
for partition_dict in partition_list:
|
@@ -790,10 +792,10 @@ class QolsysPanel(QolsysObservable):
|
|
790
792
|
partition_id = partition_dict["partition_id"]
|
791
793
|
|
792
794
|
settings_dict = {
|
793
|
-
"SYSTEM_STATUS": self.db.get_setting_partition("SYSTEM_STATUS",partition_id) or "UNKNOWN",
|
794
|
-
"SYSTEM_STATUS_CHANGED_TIME": self.db.get_setting_partition("SYSTEM_STATUS_CHANGED_TIME",partition_id) or "",
|
795
|
-
"EXIT_SOUNDS": self.db.get_setting_partition("EXIT_SOUNDS",partition_id) or "",
|
796
|
-
"ENTRY_DELAYS":
|
795
|
+
"SYSTEM_STATUS": self.db.get_setting_partition("SYSTEM_STATUS", partition_id) or "UNKNOWN",
|
796
|
+
"SYSTEM_STATUS_CHANGED_TIME": self.db.get_setting_partition("SYSTEM_STATUS_CHANGED_TIME", partition_id) or "",
|
797
|
+
"EXIT_SOUNDS": self.db.get_setting_partition("EXIT_SOUNDS", partition_id) or "",
|
798
|
+
"ENTRY_DELAYS": self.db.get_setting_partition("ENTRY_DELAYS", partition_id) or "",
|
797
799
|
}
|
798
800
|
|
799
801
|
alarm_type = []
|
@@ -803,54 +805,53 @@ class QolsysPanel(QolsysObservable):
|
|
803
805
|
else:
|
804
806
|
alarm_type.append(PartitionAlarmType(alarm))
|
805
807
|
|
806
|
-
alarm_state = PartitionAlarmState(self.db.get_state_partition("ALARM_STATE",partition_id) or "UNKNOWN")
|
808
|
+
alarm_state = PartitionAlarmState(self.db.get_state_partition("ALARM_STATE", partition_id) or "UNKNOWN")
|
807
809
|
|
808
|
-
partition = QolsysPartition(partition_dict,settings_dict,alarm_state,alarm_type)
|
810
|
+
partition = QolsysPartition(partition_dict, settings_dict, alarm_state, alarm_type)
|
809
811
|
partitions.append(partition)
|
810
812
|
|
811
813
|
return partitions
|
812
814
|
|
813
815
|
def dump(self) -> None:
|
814
816
|
LOGGER.debug("*** Qolsys Panel Information ***")
|
815
|
-
LOGGER.debug("Android Version: %s",self.ANDROID_VERSION)
|
816
|
-
LOGGER.debug("Hardware Version: %s",self.HARDWARE_VERSION)
|
817
|
-
LOGGER.debug("MAC Address: %s",self.MAC_ADDRESS)
|
818
|
-
LOGGER.debug("Unique ID: %s",self.unique_id)
|
819
|
-
LOGGER.debug("Panel Tamper State: %s",self.PANEL_TAMPER_STATE)
|
820
|
-
LOGGER.debug("AC Status: %s",self.AC_STATUS)
|
821
|
-
LOGGER.debug("Battery Status: %s",self.BATTERY_STATUS)
|
822
|
-
LOGGER.debug("GSM Connection Status: %s",self.GSM_CONNECTION_STATUS)
|
823
|
-
LOGGER.debug("GSM Signal Strength: %s",self.GSM_SIGNAL_STRENGTH)
|
824
|
-
LOGGER.debug("Fail To Communicate: %s",self.FAIL_TO_COMMUNICATE)
|
825
|
-
LOGGER.debug("System Time: %s",datetime.fromtimestamp(int(self.SYSTEM_TIME)/1000))
|
826
|
-
LOGGER.debug("Country: %s",self.COUNTRY)
|
827
|
-
LOGGER.debug("Language: %s",self.LANGUAGE)
|
828
|
-
LOGGER.debug("Temp Format: %s",self.TEMPFORMAT)
|
829
|
-
LOGGER.debug("Z-Wave Firmware Version: %s",self.ZWAVE_FIRM_WARE_VERSION)
|
830
|
-
LOGGER.debug("Z-Wave Card Present: %s",self.ZWAVE_CARD)
|
831
|
-
LOGGER.debug("Z-Wave Controller Enabled: %s",self.ZWAVE_CONTROLLER)
|
832
|
-
LOGGER.debug("Partitons Enabled: %s",self.PARTITIONS)
|
833
|
-
LOGGER.debug("Control4 Enabled: %s",self.CONTROL_4)
|
834
|
-
LOGGER.debug("Six Digit User Code Enabled: %s",self.SIX_DIGIT_USER_CODE)
|
835
|
-
LOGGER.debug("Secure Arming: %s",self.SECURE_ARMING)
|
836
|
-
LOGGER.debug("Auto-Stay: %s",self.AUTO_STAY)
|
837
|
-
LOGGER.debug("Auto-Bypass: %s",self.AUTO_BYPASS)
|
838
|
-
LOGGER.debug("Auto-Arm-Stay: %s",self.AUTO_ARM_STAY)
|
839
|
-
LOGGER.debug("Auto-Exit-Extension: %s",self.AUTO_EXIT_EXTENSION)
|
840
|
-
LOGGER.debug("Final-Exit-Door-Arming: %s",self.FINAL_EXIT_DOOR_ARMING)
|
841
|
-
LOGGER.debug("No-Arm-Low-Battery: %s",self.NO_ARM_LOW_BATTERY)
|
842
|
-
LOGGER.debug("Normal Entry Delay: %s",self.TIMER_NORMAL_ENTRY_DELAY)
|
843
|
-
LOGGER.debug("Normal Exit Delay: %s",self.TIMER_NORMAL_EXIT_DELAY)
|
844
|
-
LOGGER.debug("Long Entry Delay: %s",self.TIMER_LONG_ENTRY_DELAY)
|
845
|
-
LOGGER.debug("Long Exit Delay: %s",self.TIMER_LONG_EXIT_DELAY)
|
846
|
-
LOGGER.debug("Auxiliary Panic Enabled: %s",self.AUXILIARY_PANIC_ENABLED)
|
847
|
-
LOGGER.debug("Fire Panic Enabled: %s",self.FIRE_PANIC_ENABLED)
|
848
|
-
LOGGER.debug("Police Panic Enabled: %s",self.POLICE_PANIC_ENABLED)
|
849
|
-
LOGGER.debug("Night Mode Settings: %s",self.NIGHTMODE_SETTINGS)
|
850
|
-
LOGGER.debug("Night Mode Settings Stage: %s",self.NIGHT_SETTINGS_STATE)
|
851
|
-
LOGGER.debug("Show Security Sensors: %s",self.SHOW_SECURITY_SENSORS)
|
817
|
+
LOGGER.debug("Android Version: %s", self.ANDROID_VERSION)
|
818
|
+
LOGGER.debug("Hardware Version: %s", self.HARDWARE_VERSION)
|
819
|
+
LOGGER.debug("MAC Address: %s", self.MAC_ADDRESS)
|
820
|
+
LOGGER.debug("Unique ID: %s", self.unique_id)
|
821
|
+
LOGGER.debug("Panel Tamper State: %s", self.PANEL_TAMPER_STATE)
|
822
|
+
LOGGER.debug("AC Status: %s", self.AC_STATUS)
|
823
|
+
LOGGER.debug("Battery Status: %s", self.BATTERY_STATUS)
|
824
|
+
LOGGER.debug("GSM Connection Status: %s", self.GSM_CONNECTION_STATUS)
|
825
|
+
LOGGER.debug("GSM Signal Strength: %s", self.GSM_SIGNAL_STRENGTH)
|
826
|
+
LOGGER.debug("Fail To Communicate: %s", self.FAIL_TO_COMMUNICATE)
|
827
|
+
# LOGGER.debug("System Time: %s",datetime.fromtimestamp(int(self.SYSTEM_TIME)/1000))
|
828
|
+
LOGGER.debug("Country: %s", self.COUNTRY)
|
829
|
+
LOGGER.debug("Language: %s", self.LANGUAGE)
|
830
|
+
LOGGER.debug("Temp Format: %s", self.TEMPFORMAT)
|
831
|
+
LOGGER.debug("Z-Wave Firmware Version: %s", self.ZWAVE_FIRM_WARE_VERSION)
|
832
|
+
LOGGER.debug("Z-Wave Card Present: %s", self.ZWAVE_CARD)
|
833
|
+
LOGGER.debug("Z-Wave Controller Enabled: %s", self.ZWAVE_CONTROLLER)
|
834
|
+
LOGGER.debug("Partitons Enabled: %s", self.PARTITIONS)
|
835
|
+
LOGGER.debug("Control4 Enabled: %s", self.CONTROL_4)
|
836
|
+
LOGGER.debug("Six Digit User Code Enabled: %s", self.SIX_DIGIT_USER_CODE)
|
837
|
+
LOGGER.debug("Secure Arming: %s", self.SECURE_ARMING)
|
838
|
+
LOGGER.debug("Auto-Stay: %s", self.AUTO_STAY)
|
839
|
+
LOGGER.debug("Auto-Bypass: %s", self.AUTO_BYPASS)
|
840
|
+
LOGGER.debug("Auto-Arm-Stay: %s", self.AUTO_ARM_STAY)
|
841
|
+
LOGGER.debug("Auto-Exit-Extension: %s", self.AUTO_EXIT_EXTENSION)
|
842
|
+
LOGGER.debug("Final-Exit-Door-Arming: %s", self.FINAL_EXIT_DOOR_ARMING)
|
843
|
+
LOGGER.debug("No-Arm-Low-Battery: %s", self.NO_ARM_LOW_BATTERY)
|
844
|
+
LOGGER.debug("Normal Entry Delay: %s", self.TIMER_NORMAL_ENTRY_DELAY)
|
845
|
+
LOGGER.debug("Normal Exit Delay: %s", self.TIMER_NORMAL_EXIT_DELAY)
|
846
|
+
LOGGER.debug("Long Entry Delay: %s", self.TIMER_LONG_ENTRY_DELAY)
|
847
|
+
LOGGER.debug("Long Exit Delay: %s", self.TIMER_LONG_EXIT_DELAY)
|
848
|
+
LOGGER.debug("Auxiliary Panic Enabled: %s", self.AUXILIARY_PANIC_ENABLED)
|
849
|
+
LOGGER.debug("Fire Panic Enabled: %s", self.FIRE_PANIC_ENABLED)
|
850
|
+
LOGGER.debug("Police Panic Enabled: %s", self.POLICE_PANIC_ENABLED)
|
851
|
+
LOGGER.debug("Night Mode Settings: %s", self.NIGHTMODE_SETTINGS)
|
852
|
+
LOGGER.debug("Night Mode Settings Stage: %s", self.NIGHT_SETTINGS_STATE)
|
853
|
+
LOGGER.debug("Show Security Sensors: %s", self.SHOW_SECURITY_SENSORS)
|
852
854
|
|
853
855
|
LOGGER.debug("Users list:")
|
854
856
|
for user in self._users:
|
855
|
-
LOGGER.debug("User: %s",user["id"])
|
856
|
-
|
857
|
+
LOGGER.debug("User: %s", user["id"])
|