From bd2ad2e20beb51e525483323a125cf609190aaf8 Mon Sep 17 00:00:00 2001 From: davesmeghead Date: Sun, 28 Jul 2024 17:37:24 +0100 Subject: [PATCH] 0.9.6.8 - Bug fixes and PM10 better support --- custom_components/visonic/client.py | 2 +- custom_components/visonic/pyconst.py | 2 +- custom_components/visonic/pyvisonic.py | 21 ++++++++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/custom_components/visonic/client.py b/custom_components/visonic/client.py index 2f64b72..42555b1 100644 --- a/custom_components/visonic/client.py +++ b/custom_components/visonic/client.py @@ -122,7 +122,7 @@ # "trigger", #] -CLIENT_VERSION = "0.9.6.7" +CLIENT_VERSION = "0.9.6.8" MAX_CLIENT_LOG_ENTRIES = 300 diff --git a/custom_components/visonic/pyconst.py b/custom_components/visonic/pyconst.py index 62d3a05..60d7537 100644 --- a/custom_components/visonic/pyconst.py +++ b/custom_components/visonic/pyconst.py @@ -160,7 +160,7 @@ class AlPanelMode(AlEnum): DOWNLOAD = AlIntEnum(6) STOPPED = AlIntEnum(7) MINIMAL_ONLY = AlIntEnum(8) - COMPLETE_READONLY = AlIntEnum(9) +# COMPLETE_READONLY = AlIntEnum(9) a = AlPanelMode() # The set of panel states diff --git a/custom_components/visonic/pyvisonic.py b/custom_components/visonic/pyvisonic.py index d6e1677..ebd276b 100644 --- a/custom_components/visonic/pyvisonic.py +++ b/custom_components/visonic/pyvisonic.py @@ -100,7 +100,7 @@ def convertByteArray(s) -> bytearray: from pyhelper import (MyChecksumCalc, AlImageManager, ImageRecord, titlecase, pmPanelTroubleType_t, pmPanelAlarmType_t, AlPanelInterfaceHelper, AlSensorDeviceHelper, AlSwitchDeviceHelper) -PLUGIN_VERSION = "1.3.5.1" +PLUGIN_VERSION = "1.3.5.2" # Some constants to help readability of the code @@ -1484,7 +1484,8 @@ def _sendInterfaceResetCommand(self): while not self.suspendAllOperations and len(self.SendList) > 0: log.debug("[_sendInterfaceResetCommand] Waiting to empty send command queue") self._sendCommand(None) # Check send queue - if self.ForceStandardMode and not self.pmGotPanelDetails: + #if self.ForceStandardMode and not self.pmGotPanelDetails: + if not self.pmGotPanelDetails: self._sendCommand("MSG_BUMP") def _gotoStandardMode(self): @@ -1860,7 +1861,7 @@ async def _keep_alive_and_watchdog_timer(self): # TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE # TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE TESTING TO HERE - if self.PanelMode == AlPanelMode.STANDARD or self.PanelMode == AlPanelMode.STANDARD_PLUS or self.PanelMode == AlPanelMode.POWERLINK or self.PanelMode == AlPanelMode.MINIMAL_ONLY or self.PanelMode == AlPanelMode.COMPLETE_READONLY: + if self.PanelMode == AlPanelMode.STANDARD or self.PanelMode == AlPanelMode.STANDARD_PLUS or self.PanelMode == AlPanelMode.POWERLINK or self.PanelMode == AlPanelMode.MINIMAL_ONLY: # Dump all sensors to the file every 300 seconds (5 minutes) log_sensor_state_counter = log_sensor_state_counter + 1 if log_sensor_state_counter >= 300: @@ -2732,6 +2733,8 @@ def _createSensor(self, i, zoneInfo, sensor_type, motiondelaytime = None, part = self.onNewSensorHandler(self.SensorList[i]) # Only enrolled once self.SensorList[i].pushChange(AlSensorCondition.ENROLLED) + + return sensorType def _processKeypadsAndSirens(self, pmPanelTypeNr) -> str: sirenCnt = pmPanelConfig_t["CFG_SIRENS"][pmPanelTypeNr] @@ -2914,12 +2917,12 @@ def _processEPROMSettings(self): pmPanelTypeCodeStr = self._lookupEpromSingle("panelModelCode") idx = "{0:0>2}{1:0>2}".format(hex(self.PanelType).upper()[2:], hex(int(pmPanelTypeCodeStr)).upper()[2:]) - pmPanelName = pmPanelName_t[idx] if idx in pmPanelName_t else "Unknown" + pmPanelName = pmPanelName_t[idx] if idx in pmPanelName_t else "Unknown_" + idx #log.debug("[Process Settings] Processing settings - panel code index {0}".format(idx)) # INTERFACE : Add this param to the status panel first - self.PanelStatus["Panel Name"] = pmPanelName + #self.PanelStatus["Panel Name"] = pmPanelName # ------------------------------------------------------------------------------------------------------------------------------------------------ # Process Panel Settings to display in the user interface @@ -4750,9 +4753,9 @@ def handle_msgtypeF4(self, data) -> bool: # Static JPG Image elif zone - 1 in self.SensorList and self.SensorList[zone-1].getSensorType() == AlSensorType.CAMERA: log.debug(f"[handle_msgtypeF4] Processing") - # Here when PanelMode is COMPLETE_READONLY, MINIMAL_ONLY, STANDARD, STANDARD_PLUS, POWERLINK + # Here when PanelMode is MINIMAL_ONLY, STANDARD, STANDARD_PLUS, POWERLINK - if self.PanelMode == AlPanelMode.MINIMAL_ONLY or self.PanelMode == AlPanelMode.COMPLETE_READONLY: + if self.PanelMode == AlPanelMode.MINIMAL_ONLY: # Support externally requested images, from a real PowerLink Hardware device for example if not self.ImageManager.isValidZone(zone): self.ImageManager.create(zone, 11) # This makes sure that there isn't an ongoing image retrieval for this sensor @@ -4787,7 +4790,7 @@ def handle_msgtypeF4(self, data) -> bool: # Static JPG Image log.debug(f"[handle_msgtypeF4] Not processing F4 0x05 data") elif self.ImageManager.hasStartedSequence(): # Image receipt has been initialised by self.ImageManager.setCurrent - # Therefore we only get here when PanelMode is COMPLETE_READONLY, MINIMAL_ONLY, STANDARD, STANDARD_PLUS, POWERLINK + # Therefore we only get here when PanelMode is MINIMAL_ONLY, STANDARD, STANDARD_PLUS, POWERLINK datastart = 4 inSequence = self.ImageManager.addData(data[datastart:datastart+datalen], sequence) if inSequence: @@ -4933,7 +4936,7 @@ def getPanelStatusDict(self, include_extended_status : bool) -> dict: "Download Timeout": self.DownloadTimeout, "Download Retries": self.pmDownloadRetryCount, "Panel Problem Count": self.PanelProblemCount, - "Panel Problem Time": self.LastPanelProblemTime if self.LastPanelProblemTime else "" + "Last Panel Problem Time": self.LastPanelProblemTime if self.LastPanelProblemTime else "" } #log.debug("[getPanelStatusDict A] type a={0} type c={1}".format(type(a), type(c))) self.merge(a,c)