mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-13 18:14:28 +05:00
add sensor filters
This commit is contained in:
@@ -187,7 +187,7 @@ class MegaI2C(FilterBadValues):
|
|||||||
ret = self.mega.values.get(self._params)
|
ret = self.mega.values.get(self._params)
|
||||||
if self.customize.get(CONF_HEX_TO_FLOAT):
|
if self.customize.get(CONF_HEX_TO_FLOAT):
|
||||||
try:
|
try:
|
||||||
ret = struct.unpack('!f', bytes.fromhex('41973333'))[0]
|
ret = struct.unpack('!f', bytes.fromhex(ret))[0]
|
||||||
except:
|
except:
|
||||||
self.lg.warning(f'could not convert {ret} form hex to float')
|
self.lg.warning(f'could not convert {ret} form hex to float')
|
||||||
tmpl: Template = self.customize.get(CONF_CONV_TEMPLATE, self.customize.get(CONF_VALUE_TEMPLATE))
|
tmpl: Template = self.customize.get(CONF_CONV_TEMPLATE, self.customize.get(CONF_VALUE_TEMPLATE))
|
||||||
|
|||||||
Reference in New Issue
Block a user