From 4017c3d938a7ba0d085fe68c08d84e58009d9195 Mon Sep 17 00:00:00 2001 From: marq24 Date: Wed, 8 May 2024 15:49:13 +0200 Subject: [PATCH] remove unknown TAGs from ALARM_BITS if not supported by Waterkotte device --- .../pywaterkotte_ha/__init__.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/custom_components/waterkotte_heatpump/pywaterkotte_ha/__init__.py b/custom_components/waterkotte_heatpump/pywaterkotte_ha/__init__.py index c1841ac..508449e 100644 --- a/custom_components/waterkotte_heatpump/pywaterkotte_ha/__init__.py +++ b/custom_components/waterkotte_heatpump/pywaterkotte_ha/__init__.py @@ -302,7 +302,13 @@ async def _read_tags(self, tags: Sequence[WKHPTag], results=None, results_status re.MULTILINE, ) if match is None: - _LOGGER.warning(f"Tag: '{tag}' not found in response!") + # special handling for "unknown" tags in the ALARM_BITS field... [if one of the + # I2xxx Tags is not known, we're simply going to remove that tag from the tag list] + if tag in WKHPTag.ALARM_BITS.tags: + WKHPTag.ALARM_BITS.tags.remove(tag) + _LOGGER.info(f"Tag: '{tag}' not found in response - removing tag from WKHPTag.ALARM_BITS") + else: + _LOGGER.warning(f"Tag: '{tag}' not found in response!") results_status[tag] = "E_NOTFOUND" else: results_status[tag] = "E_INACTIVE" @@ -546,7 +552,13 @@ async def _read_tags(self, tags: Sequence[WKHPTag], results=None, results_status # val_status = "E_INACTIVE" # pylint: disable=possibly-unused-variable # print("Tag: %s is inactive!", tag) if match is None: - _LOGGER.warning(f"Tag: '{tag}' not found in response!") + # special handling for "unknown" tags in the ALARM_BITS field... [if one of the + # I2xxx Tags is not known, we're simply going to remove that tag from the tag list] + if tag in WKHPTag.ALARM_BITS.tags: + WKHPTag.ALARM_BITS.tags.remove(tag) + _LOGGER.info(f"Tag: '{tag}' not found in response - removing tag from WKHPTag.ALARM_BITS") + else: + _LOGGER.warning(f"Tag: '{tag}' not found in response!") results_status[tag] = "E_NOTFOUND" else: # if val_status == "E_INACTIVE":