mirror of
https://github.com/andvikt/mega_hacs.git
synced 2026-02-04 08:27:48 +05:00
fix sensors
This commit is contained in:
@@ -519,11 +519,14 @@ class MegaD:
|
|||||||
elif idx is not None and idx > 0:
|
elif idx is not None and idx > 0:
|
||||||
v: str = self.values.get(f"chache_{pt}")
|
v: str = self.values.get(f"chache_{pt}")
|
||||||
if idx is not None:
|
if idx is not None:
|
||||||
v = safe_float(v.split("/")[idx])
|
vv = v.split("/")
|
||||||
ret = {_params: v}
|
if len(vv) == 3:
|
||||||
|
v = vv[idx]
|
||||||
|
else:
|
||||||
|
v: None
|
||||||
|
ret = {_params: safe_float(v)}
|
||||||
except Exception:
|
except Exception:
|
||||||
self.lg.exception(f"while getting i2c {params=}")
|
self.lg.exception(f"while getting i2c {params=}")
|
||||||
except asyncio.TimeoutError:
|
|
||||||
return
|
return
|
||||||
self.lg.debug("i2c response: %s", ret)
|
self.lg.debug("i2c response: %s", ret)
|
||||||
if delay:
|
if delay:
|
||||||
|
|||||||
Reference in New Issue
Block a user