Просмотр исходного кода

Add support for Deltaco and Smatrul dual smartplugs.

Issue #527, #521

Merged into a single config, as the dp assignments follow the standard
layout, and probably match many other devices if we are lenient about
which are optional.  Otherwise smartplug variations with only minor
differences are multiplying too quickly.

Should also cover #480 except for the different child lock dp
assignment, and additional master switch.
Jason Rumney 3 лет назад
Родитель
Сommit
183726ce86

+ 2 - 0
ACKNOWLEDGEMENTS.md

@@ -211,3 +211,5 @@ Further device support has been made with the assistance of users.  Please consi
 - [nijel](https://github.com/nijel) for assisting with support for WHM-04 doorbells.
 - [shiner66](https://github.com/shiner66) for assisting with support for Shinco 30D dehumidifier.
 - [A-J-O](https://github.com/A-J-O) for assisting with support for Heat Storm 6000W heaters.
+- [demonkazuya](https://github.com/demonkazuya) for assisting with support for Smartrul smart wallplugs (dual_power_monitor_smartplugv2)
+- [runlar](https://github.com/runlar) for assisting with support for Deltaco SH-P02E smartplugs (dual_power_monitoring_smartplugv2 without some optional features)

+ 1 - 0
DEVICES.md

@@ -205,6 +205,7 @@ the best option.
 - DIGOO DG-SP202 dual smartplug with energy monitoring and timers
 - DIGOO DG-SP01 USB smartplug with night light
 - Dual power monitoring smartplug (Geex)
+- Dual power monitoring smartplug v2 (Smatrul, Deltaco)
 - ES01 3 outlet + USB powerstrip with individual timers
 - Gosund P1 3 outlet + USB powerstrip with power monitoring
 - Grid Connect double outlet wall socket

+ 164 - 0
custom_components/tuya_local/devices/dual_power_monitor_smartplugv2.yaml

@@ -0,0 +1,164 @@
+name: Dual smartplug
+products:
+  - id: 3jnmzqoyuopg4vtf
+    name: Deltaco SH-P02
+  - id: arf4t5idnhpt88ii
+    name: Smatrul dual wall plug
+primary_entity:
+  entity: switch
+  name: Outlet 1
+  class: outlet
+  dps:
+    - id: 1
+      type: boolean
+      name: switch
+    - id: 17
+      type: integer
+      name: add_ele
+      optional: true
+    - id: 21
+      type: bitfield
+      name: factory_test
+      optional: true
+    - id: 25
+      type: integer
+      name: ele_calibration
+      optional: true
+    - id: 26
+      type: bitfield
+      name: fault_code
+      optional: true
+    - id: 42
+      type: string
+      name: schedule
+      optional: true
+secondary_entities:
+  - entity: switch
+    name: Outlet 2
+    class: outlet
+    dps:
+      - id: 2
+        type: boolean
+        name: switch
+  - entity: number
+    name: Timer 1
+    category: config
+    icon: "mdi:timer"
+    dps:
+      - id: 9
+        type: integer
+        name: value
+        unit: min
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+  - entity: number
+    name: Timer 2
+    category: config
+    icon: "mdi:timer"
+    dps:
+      - id: 10
+        type: integer
+        name: value
+        unit: min
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+  - entity: sensor
+    name: Current
+    class: current
+    category: diagnostic
+    dps:
+      - id: 18
+        type: integer
+        name: sensor
+        unit: mA
+        class: measurement
+      - id: 23
+        type: integer
+        name: calibration
+        optional: true
+  - entity: sensor
+    name: Power
+    class: power
+    category: diagnostic
+    dps:
+      - id: 19
+        type: integer
+        name: sensor
+        unit: W
+        class: measurement
+        mapping:
+          - scale: 10
+      - id: 24
+        type: integer
+        name: calibration
+        optional: true
+  - entity: sensor
+    name: Voltage
+    class: voltage
+    category: diagnostic
+    dps:
+      - id: 20
+        type: integer
+        name: sensor
+        unit: V
+        class: measurement
+        mapping:
+          - scale: 10
+      - id: 22
+        type: integer
+        name: calibration
+        optional: true
+  - entity: binary_sensor
+    name: Fault
+    class: problem
+    category: diagnostic
+    dps:
+      - id: 26
+        type: bitfield
+        name: sensor
+        optional: true
+        persist: false
+        mapping:
+          - dps_val: null
+            value: false
+          - dps_val: 0
+            value: false
+          - value: true
+  - entity: select
+    name: Initial state
+    icon: "mdi:toggle-switch"
+    category: config
+    dps:
+      - id: 
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: "on"
+            value: "On"
+          - dps_val: "off"
+            value: "Off"
+          - dps_val: "memory"
+            value: "Last state"
+          - dps_val: null
+            invalid: true
+  - entity: lock
+    name: Child lock
+    icon: "mdi:hand-back-right-off"
+    category: config
+    dps:
+      - id: 41
+        type: boolean
+        name: lock
+        optional: true
+        mapping:
+          - dps_val: null
+            invalid: true