From e3d414919dbcf3de9f5fc9dbacdff54c41f395cb Mon Sep 17 00:00:00 2001 From: LiShuzhen Date: Fri, 21 Nov 2025 10:13:43 +0800 Subject: [PATCH] fix: cuco.plug.cp7pd power consumption and power value precision (#1502) --- custom_components/xiaomi_home/miot/miot_device.py | 1 + .../xiaomi_home/miot/specs/spec_modify.yaml | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/custom_components/xiaomi_home/miot/miot_device.py b/custom_components/xiaomi_home/miot/miot_device.py index 524462a..a0e2edb 100644 --- a/custom_components/xiaomi_home/miot/miot_device.py +++ b/custom_components/xiaomi_home/miot/miot_device.py @@ -748,6 +748,7 @@ class MIoTDevice: 'w': UnitOfPower.WATT, 'W': UnitOfPower.WATT, 'kW': UnitOfPower.KILO_WATT, + 'Wh': UnitOfEnergy.WATT_HOUR, 'kWh': UnitOfEnergy.KILO_WATT_HOUR, 'A': UnitOfElectricCurrent.AMPERE, 'mA': UnitOfElectricCurrent.MILLIAMPERE, diff --git a/custom_components/xiaomi_home/miot/specs/spec_modify.yaml b/custom_components/xiaomi_home/miot/specs/spec_modify.yaml index b5207ee..8eaad03 100644 --- a/custom_components/xiaomi_home/miot/specs/spec_modify.yaml +++ b/custom_components/xiaomi_home/miot/specs/spec_modify.yaml @@ -371,6 +371,19 @@ urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2: urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2d:1: prop.3.2: unit: mA +urn:miot-spec-v2:device:outlet:0000A002:cuco-cp7pd:1: + prop.11.1: + unit: Wh + value-range: + - 0 + - 65535 + - 0.001 + expr: (src_value*1000) + prop.11.4: + value-range: + - 0 + - 10000 + - 0.01 urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:1: prop.11.1: format: float