Przeglądaj źródła

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 lat temu
rodzic
commit
7e4ffad5f3

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

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