mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Round sensor readings for bom (#39513)
This commit is contained in:
parent
5fafaa3c4f
commit
e3354895f8
@ -231,7 +231,11 @@ class BOMCurrentData:
|
|||||||
through the entire BOM provided dataset.
|
through the entire BOM provided dataset.
|
||||||
"""
|
"""
|
||||||
condition_readings = (entry[condition] for entry in self._data)
|
condition_readings = (entry[condition] for entry in self._data)
|
||||||
return next((x for x in condition_readings if x != "-"), None)
|
reading = next((x for x in condition_readings if x != "-"), None)
|
||||||
|
|
||||||
|
if isinstance(reading, (int, float)):
|
||||||
|
return round(reading, 2)
|
||||||
|
return reading
|
||||||
|
|
||||||
def should_update(self):
|
def should_update(self):
|
||||||
"""Determine whether an update should occur.
|
"""Determine whether an update should occur.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user