Skip to content

Commit

Permalink
🐛 Beta: Check Fix for #4
Browse files Browse the repository at this point in the history
- Check Fix for #4
  • Loading branch information
Ludy87 authored May 14, 2022
2 parents c0dbb11 + 05e07ca commit 5d54fcb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions custom_components/ecotrend_ista/manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"domain": "ecotrend_ista",
"name": "ecotrend ista",
"version": "v1.0.6",
"version": "v1.0.7-beta",
"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"
Expand Down
20 changes: 16 additions & 4 deletions custom_components/ecotrend_ista/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 5d54fcb

Please sign in to comment.