Explorar o código

Elivco: merge into smartplugv2_energyv3.yaml

After review of #294, the difference in dp 44 type seems to be an
error.  Since that issue was never confirmed as fixed, assume it isn't
working for the original reporter, as their earlier logs showed it as
a string.
- Make dp 44 a string, and move it to an attribute, as it is too
complex to deal with
- Make dp 17 optional, to allow it to match Elivco.
- Move calibration dps to their respective entities to tidy up.

As discussed on issue #392
Jason Rumney %!s(int64=3) %!d(string=hai) anos
pai
achega
f62a391280

+ 1 - 2
DEVICES.md

@@ -180,7 +180,6 @@
 - DIGOO DG-SP202 dual smartplug with energy monitoring and timers
 - DIGOO DG-SP01 USB smartplug with night light
 - Dual power monitoring smartplug (Geex)
-- Elivco energy monitoring smartplug
 - ES01 3 outlet + USB powerstrip with individual timers
 - Gosund P1 3 outlet + USB powerstrip with power monitoring
 - Grid Connect double outlet wall socket
@@ -205,7 +204,7 @@ generic configurations known to work with multiple brands of device.
 - Generic smartplug with energy monitoring (newer models)
   _confirmed working with Kogan single smartplug with USB and Rillpac smartplugs_
 - Generic smartplug with more advanced energy monitoring
-  _confirmed working with CBE smartplugs, another variant with child lock, backlight and inching switch confirmed with Aubess_
+  _confirmed working with CBE smartplugs, another variant with child lock, backlight and inching switch confirmed with Aubess and Elivco_
 - Generic smartplug with some additional encoded schedule info.
   _confirmed working as a simple switch and timer with Kashimura KJ-173_
 - Generic double switch with timers (confirmed with Living dual switch and another v2 variant with Avatto dual switch)

+ 0 - 140
custom_components/tuya_local/devices/elivco_smartplug.yaml

@@ -1,140 +0,0 @@
-name: Energy monitoring smartplug
-products:
-  - id: wrz6vzch8htux2zp
-    name: Elivco CB2S-16DL
-primary_entity:
-  entity: switch
-  class: outlet
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-    - id: 21
-      type: integer
-      name: test_bit
-    - id: 25
-      type: integer
-      name: energy_calibration
-    - id: 26
-      type: bitfield
-      name: fault_code
-    - id: 42
-      type: base64
-      name: cycle_timer
-    - id: 43
-      type: base64
-      name: random_timer
-    - id: 44
-      type: base64
-      name: inching
-secondary_entities:
-  - 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
-  - entity: sensor
-    category: diagnostic
-    class: current
-    name: Current
-    dps:
-      - id: 18
-        name: sensor
-        type: integer
-        class: measurement
-        unit: mA
-      - id: 23
-        type: integer
-        name: calibration
-  - entity: sensor
-    category: diagnostic
-    class: power
-    name: Power
-    dps:
-      - id: 19
-        name: sensor
-        type: integer
-        class: measurement
-        unit: W
-        mapping:
-          - scale: 10
-      - id: 24
-        type: integer
-        name: calibration
-  - entity: sensor
-    category: diagnostic
-    class: voltage
-    name: Voltage
-    dps:
-      - id: 20
-        name: sensor
-        type: integer
-        class: measurement
-        unit: V
-        mapping:
-          - scale: 10
-      - id: 22
-        type: integer
-        name: calibration
-  - entity: binary_sensor
-    class: problem
-    category: diagnostic
-    name: Error
-    dps:
-      - id: 26
-        type: bitfield
-        name: sensor
-        mapping:
-          - dps_val: 0
-            value: false
-          - value: true
-  - entity: select
-    category: config
-    name: Initial state
-    icon: "mdi:toggle-switch"
-    dps:
-      - id: 38
-        type: string
-        name: option
-        mapping:
-          - dps_val: "on"
-            value: "On"
-          - dps_val: "off"
-            value: "Off"
-          - dps_val: memory
-            value: "Last State"
-  - entity: lock
-    name: Child Lock
-    category: config
-    icon: "mdi:hand-back-right-off"
-    dps:
-      - id: 41
-        type: boolean
-        name: lock
-  - entity: select
-    name: Light mode
-    category: config
-    icon: "mdi:lightbulb"
-    dps:
-      - id: 40
-        type: string
-        name: option
-        mapping:
-          - dps_val: relay
-            value: State
-          - dps_val: pos
-            value: Position
-          - dps_val: none
-            value: "Off"
-          - dps_val: "on"
-            value: "On"

+ 22 - 23
custom_components/tuya_local/devices/smartplugv2_energyv3.yaml

@@ -2,6 +2,8 @@ name: Energy monitoring smartplug
 products:
   - id: 2iepauebcvo74ujc
     name: Aubess 20A
+  - id: wrz6vzch8htux2zp
+    name: Elivco CB2S-16DL
 primary_entity:
   entity: switch
   class: outlet
@@ -12,27 +14,18 @@ primary_entity:
     - id: 21
       type: integer
       name: test_bit
-    - id: 22
-      type: integer
-      name: voltage_calibration
-    - id: 23
-      type: integer
-      name: current_calibration
-    - id: 24
-      type: integer
-      name: power_calibration
-    - id: 25
-      type: integer
-      name: energy_calibration
     - id: 26
       type: bitfield
       name: fault_code
     - id: 42
-      type: string
+      type: base64
       name: cycle_timer
     - id: 43
-      type: string
+      type: base64
       name: random_timer
+    - id: 44
+      type: base64
+      name: inching
 secondary_entities:
   - entity: number
     category: config
@@ -59,6 +52,12 @@ secondary_entities:
         type: integer
         unit: Wh
         class: total_increasing
+        optional: true
+      - id: 25
+        type: integer
+        name: calibration
+        # seems to be present even when 17 is missing, but for consistency
+        optional: true
   - entity: sensor
     category: diagnostic
     class: current
@@ -69,6 +68,9 @@ secondary_entities:
         type: integer
         class: measurement
         unit: mA
+      - id: 23
+        type: integer
+        name: calibration
   - entity: sensor
     category: diagnostic
     class: power
@@ -81,6 +83,9 @@ secondary_entities:
         unit: W
         mapping:
           - scale: 10
+      - id: 24
+        type: integer
+        name: calibration
   - entity: sensor
     category: diagnostic
     class: voltage
@@ -93,6 +98,9 @@ secondary_entities:
         unit: V
         mapping:
           - scale: 10
+      - id: 22
+        type: integer
+        name: calibration
   - entity: binary_sensor
     class: problem
     category: diagnostic
@@ -145,12 +153,3 @@ secondary_entities:
             value: "Off"
           - dps_val: "on"
             value: "On"
-  - entity: switch
-    name: Auto-off
-    category: config
-    icon: "mdi:camera-timer"
-    dps:
-      - id: 44
-        type: boolean
-        name: switch
-