Преглед на файлове

smartplugv2: disable forced updates.

Many plugs seem to misbehave when the updatedps command is used.
Instead, add a new config: `smartplugv2_polled_power` for the devices
that need it.

This will probably need some changes to the tests, as the smartplugv2
will no longer be a unique match based on dps alone.

Issue #483
Jason Rumney преди 3 години
родител
ревизия
a0e5baf6bf
променени са 3 файла, в които са добавени 88 реда и са изтрити 8 реда
  1. 7 5
      DEVICES.md
  2. 0 3
      custom_components/tuya_local/devices/smartplugv2.yaml
  3. 81 0
      custom_components/tuya_local/devices/smartplugv2_polled_power.yaml

+ 7 - 5
DEVICES.md

@@ -225,11 +225,13 @@ of device.
   _confirmed as working with Kogan KASPS10A3P3UA 3 socket + USB powerstrip
   _confirmed as working with Kogan KASPS10A3P3UA 3 socket + USB powerstrip
 - 4 way powerstrip with USB
 - 4 way powerstrip with USB
   _confirmed as working with AOFO ZLD-44EU-W_
   _confirmed as working with AOFO ZLD-44EU-W_
-- Generic smartplug with energy monitoring (older models)
-  _confirmed as working with Kogan and Blitzwolf single smartplugs_
-- Generic smartplug with energy monitoring (newer models)
-  _confirmed as working with Kogan single smartplug with USB and Rillpac smartplugs_
-- Generic smartplug with energy monitoring and USB ports
+- Generic smartplug with power monitoring (older models)
+  _confirmed as working with Kogan and Blitzwolf single smartplugs (smartplugv1)_
+- Generic smartplug with power monitoring (newer models)
+  _confirmed as working with Kogan single smartplug with USB and Rillpac smartplugs (smartplugv2)_
+- Generic smartplug with power monitoring requiring polling of sensors
+  _same as above smartplugv2, but only reports power/current/voltage when explicitly requested - choose `smartplugv2_polled_power`_
+- Generic smartplug with power monitoring and USB ports
   _confirmed as working with Gosund SP112 smartplugs_
   _confirmed as working with Gosund SP112 smartplugs_
 - Generic smartplug with more advanced energy monitoring
 - Generic smartplug with more advanced energy monitoring
   _confirmed working with CBE smartplugs, another variant with child lock, backlight and inching switch confirmed with Aubess and Elivco_
   _confirmed working with CBE smartplugs, another variant with child lock, backlight and inching switch confirmed with Aubess and Elivco_

+ 0 - 3
custom_components/tuya_local/devices/smartplugv2.yaml

@@ -25,7 +25,6 @@ secondary_entities:
         name: sensor
         name: sensor
         type: integer
         type: integer
         class: measurement
         class: measurement
-        force: true
         unit: V
         unit: V
         mapping:
         mapping:
           - scale: 10
           - scale: 10
@@ -42,7 +41,6 @@ secondary_entities:
         name: sensor
         name: sensor
         type: integer
         type: integer
         class: measurement
         class: measurement
-        force: true
         unit: mA
         unit: mA
       - id: 23
       - id: 23
         type: integer
         type: integer
@@ -57,7 +55,6 @@ secondary_entities:
         name: sensor
         name: sensor
         type: integer
         type: integer
         class: measurement
         class: measurement
-        force: true
         unit: W
         unit: W
         mapping:
         mapping:
           - scale: 10
           - scale: 10

+ 81 - 0
custom_components/tuya_local/devices/smartplugv2_polled_power.yaml

@@ -0,0 +1,81 @@
+name: Energy monitoring smartplug
+primary_entity:
+  entity: switch
+  class: outlet
+  dps:
+    - id: 1
+      type: boolean
+      name: switch
+    - id: 21
+      type: bitfield
+      name: factory_test
+      optional: true
+    - id: 26
+      type: integer
+      name: fault_code
+      optional: true
+secondary_entities:
+  - entity: sensor
+    category: diagnostic
+    class: voltage
+    name: Voltage
+    dps:
+      - id: 20
+        name: sensor
+        type: integer
+        class: measurement
+        force: true
+        unit: V
+        mapping:
+          - scale: 10
+      - id: 22
+        type: integer
+        name: calibration
+        optional: true
+  - entity: sensor
+    category: diagnostic
+    class: current
+    name: Current
+    dps:
+      - id: 18
+        name: sensor
+        type: integer
+        class: measurement
+        force: true
+        unit: mA
+      - id: 23
+        type: integer
+        name: calibration
+        optional: true
+  - entity: sensor
+    category: diagnostic
+    class: power
+    name: Power
+    dps:
+      - id: 19
+        name: sensor
+        type: integer
+        class: measurement
+        force: true
+        unit: W
+        mapping:
+          - scale: 10
+      - id: 24
+        type: integer
+        name: calibration
+        optional: true
+  - entity: number
+    category: config
+    name: Timer
+    icon: "mdi:timer"
+    dps:
+      - id: 9
+        type: integer
+        name: value
+        unit: min
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60