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