From 8171624e5b6607b4a27e1887cb7370aad735ac60 Mon Sep 17 00:00:00 2001 From: Ludy87 Date: Sat, 14 May 2022 19:04:57 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Beta:=20Check=20Fix=20for=20?= =?UTF-8?q?#4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/ecotrend_ista/manifest.json | 4 ++-- custom_components/ecotrend_ista/sensor.py | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/custom_components/ecotrend_ista/manifest.json b/custom_components/ecotrend_ista/manifest.json index 90c8113..12c3d6d 100644 --- a/custom_components/ecotrend_ista/manifest.json +++ b/custom_components/ecotrend_ista/manifest.json @@ -1,12 +1,12 @@ { "domain": "ecotrend_ista", "name": "ecotrend ista", - "version": "v1.0.6", + "version": "v1.0.7", "documentation": "https://github.com/Ludy87/ecotrend-ista/tree/main", "issue_tracker": "https://github.com/Ludy87/ecotrend-ista/issues", "dependencies": [], "requirements": [ - "pyecotrend_ista==1.0.30" + "pyecotrend_ista==1.0.31" ], "codeowners": ["@Ludy87"], "iot_class": "local_polling" diff --git a/custom_components/ecotrend_ista/sensor.py b/custom_components/ecotrend_ista/sensor.py index 0e4ce2d..d6897e9 100644 --- a/custom_components/ecotrend_ista/sensor.py +++ b/custom_components/ecotrend_ista/sensor.py @@ -158,7 +158,7 @@ def __init__( description: SensorEntityDescription, consum: Dict[str, Any], updateTime: timedelta, - year: str, + year: int, unit: str, ) -> None: super().__init__(controller, description, consum, unit) @@ -171,7 +171,11 @@ def __init__( async def _async_update(self) -> None: consum: Dict[str, Any] = await self._controller.getConsumById(self._name) # warmwasser_yyyy_m_xxxxxxxxx if self.entity_description.key == consum.get("type", ""): - self._attr_native_value = float(str(consum.get("value{}".format(self._unit), "-1")).replace(",", ".")) + try: + self._attr_native_value = float(str(consum.get("value{}".format(self._unit), "-1")).replace(",", ".")) + except ValueError as e: + _LOGGER.error(e) + _LOGGER.error(await self._controller.getTypes()) _LOGGER.debug( "Updating EcoYearSensor: %s | Verbrauch: %s", self._name, @@ -202,7 +206,11 @@ def __init__( async def _async_update(self) -> None: consum: Dict[str, Any] = await self._controller.getConsumById(self._name) # warmwasser_yyyy_m_xxxxxxxxx if self.entity_description.key == consum.get("type", ""): - self._attr_native_value = float(str(consum.get("value{}".format(self._unit), "-1")).replace(",", ".")) + try: + self._attr_native_value = float(str(consum.get("value{}".format(self._unit), "-1")).replace(",", ".")) + except ValueError as e: + _LOGGER.error(e) + _LOGGER.error(await self._controller.getTypes()) _LOGGER.debug( "Updating EcoYearMonthSensor: %s | Verbrauch: %s", self._name, @@ -228,7 +236,11 @@ def __init__( async def _async_update(self) -> None: consum: Dict[str, Any] = await self._controller.getConsumById(self._name, True) # warmwasser_xxxxxxxxx if self.entity_description.key == consum.get("type", ""): - self._attr_native_value = float(str(consum.get("value{}".format(self._unit), "-1")).replace(",", ".")) + try: + self._attr_native_value = float(str(consum.get("value{}".format(self._unit), "-1")).replace(",", ".")) + except ValueError as e: + _LOGGER.error(e) + _LOGGER.error(await self._controller.getTypes()) _LOGGER.debug( "Updating EcoSensor: %s | Verbrauch: %s", self._name, From 05e07cae8ae8a065ef9ad625a6e10370187bef93 Mon Sep 17 00:00:00 2001 From: Ludy87 Date: Sat, 14 May 2022 19:11:18 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=96=20v1.0.7-beta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ludy87 --- custom_components/ecotrend_ista/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/ecotrend_ista/manifest.json b/custom_components/ecotrend_ista/manifest.json index 12c3d6d..d05e90c 100644 --- a/custom_components/ecotrend_ista/manifest.json +++ b/custom_components/ecotrend_ista/manifest.json @@ -1,7 +1,7 @@ { "domain": "ecotrend_ista", "name": "ecotrend ista", - "version": "v1.0.7", + "version": "v1.0.7-beta", "documentation": "https://github.com/Ludy87/ecotrend-ista/tree/main", "issue_tracker": "https://github.com/Ludy87/ecotrend-ista/issues", "dependencies": [],