瀏覽代碼

Smartplugv2 Energyv3: workaround for unreported power when off

Some smartplugs don't report power readings (and probably other
sensors, but the power one is important for the energy dashboard)
while the switch is off.  This leads to a Riemann Sum helper
estimating the wrong energy usage during the power off period, because
all it has to work with is the last known power reading.

Currently the only known device with this issue matches this config,
so the change is only made here, but the same solution could be copied
to other configs where needed.  In the case of plugs that do report
power usage correctly while off, it may be more accurate not to have
this forcing to 0, as the WiFi module consumes some small amount of
power, and some smartplugs report that usage (others don't).

Discussion #1192
Jason Rumney 2 年之前
父節點
當前提交
7e4ffad5f3
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      custom_components/tuya_local/devices/smartplugv2_energyv3.yaml

+ 7 - 0
custom_components/tuya_local/devices/smartplugv2_energyv3.yaml

@@ -86,6 +86,13 @@ secondary_entities:
         unit: W
         unit: W
         mapping:
         mapping:
           - scale: 10
           - scale: 10
+            constraint: switch
+            conditions:
+              - dps_val: false
+                value: 0
+      - id: 1
+        type: boolean
+        name: switch
       - id: 24
       - id: 24
         type: integer
         type: integer
         name: calibration
         name: calibration