mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-11-29 18:19:06 +08:00
feat: format value, then evaluate by expression, and set precision at last (#1516)
This commit is contained in:
@@ -110,7 +110,7 @@ class Sensor(MIoTPropertyEntity, SensorEntity):
|
||||
self._attr_native_unit_of_measurement = list(
|
||||
unit_sets)[0] if unit_sets else None
|
||||
# Set suggested precision
|
||||
if spec.format_ in {int, float} and spec.expr is None:
|
||||
if spec.format_ == float:
|
||||
self._attr_suggested_display_precision = spec.precision
|
||||
# Set state_class
|
||||
if spec.state_class:
|
||||
|
||||
Reference in New Issue
Block a user