fix: cuco.plug.cp2 voltage and power value ratio

This commit is contained in:
LiShuzhen 2025-03-25 09:34:11 +08:00
parent e174a73f52
commit 12553f1602
2 changed files with 9 additions and 1 deletions

View File

@ -121,3 +121,11 @@ urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:3:
expr: round(src_value*6/1000000, 3)
urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:1: urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:3
urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:2: urn:miot-spec-v2:device:outlet:0000A002:chuangmi-212a01:3
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2:
prop.2.3:
expr: round(src_value/10, 1)
prop.2.4:
unit: mA
prop.3.2:
expr: round(src_value/10, 1)
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:1: urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2

View File

@ -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}:
if spec.format_ in {int, float} and spec.expr is None:
self._attr_suggested_display_precision = spec.precision
# Set state_class
if spec.state_class: