Skip to content

Commit

Permalink
fix sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
Викторов Андрей Германович authored and Викторов Андрей Германович committed Oct 16, 2023
1 parent 5fc4e1a commit 3e54350
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions custom_components/mega/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,14 @@ async def _update_i2c(self, params):
elif idx is not None and idx > 0:
v: str = self.values.get(f"chache_{pt}")
if idx is not None:
v = safe_float(v.split("/")[idx])
ret = {_params: v}
vv = v.split("/")
if len(vv) == 3:
v = vv[idx]
else:
v: None
ret = {_params: safe_float(v)}
except Exception:
self.lg.exception(f"while getting i2c {params=}")
except asyncio.TimeoutError:
return
self.lg.debug("i2c response: %s", ret)
if delay:
Expand Down

0 comments on commit 3e54350

Please sign in to comment.