From ab1e730335279482f66cab25e661eb4cbc0743ff Mon Sep 17 00:00:00 2001 From: Hekmon Date: Mon, 20 Nov 2023 09:45:57 +0100 Subject: [PATCH] fix ads extra --- custom_components/linkytic/sensor.py | 1 + custom_components/linkytic/serial_reader.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/linkytic/sensor.py b/custom_components/linkytic/sensor.py index 07f7846..8be0afd 100644 --- a/custom_components/linkytic/sensor.py +++ b/custom_components/linkytic/sensor.py @@ -1374,6 +1374,7 @@ def update(self): # Handle entity availability if value is None: if self._attr_available: + self._extra = {} if not self._serial_controller.is_connected(): _LOGGER.debug( "%s: marking the %s sensor as unavailable: serial connection lost", diff --git a/custom_components/linkytic/serial_reader.py b/custom_components/linkytic/serial_reader.py index eee0335..4ffacbd 100644 --- a/custom_components/linkytic/serial_reader.py +++ b/custom_components/linkytic/serial_reader.py @@ -379,7 +379,6 @@ def parse_ads(self, ads): len(ads), ads, ) - self._extra = {} return # let's parse ADS as EURIDIS device_identification = {DID_YEAR: ads[2:4], DID_REGNUMBER: ads[6:]} @@ -408,7 +407,7 @@ def parse_ads(self, ads): # # Update device infos self.device_identification = device_identification # Parsing done - _LOGGER.debug("%s: parsed ADS: %s", self._title, repr(self._extra)) + _LOGGER.debug("%s: parsed ADS: %s", self._title, repr(self.device_identification)) class InvalidChecksum(Exception):