Explorar o código

Add support for Aubess smart switches.

These have more features than any of the generic smart switches encountered
to date.  Added as generic "smartplugv2_energyv3", as it follows a common
pattern for dps assignment, but contains extra inching, cycle timer and
child lock support compared to smartplugv2_energyv2 (child lock may be there in
v2, as there is a matching unknown boolean dp).

Issue #294
Jason Rumney %!s(int64=3) %!d(string=hai) anos
pai
achega
3fd0a3e15b

+ 1 - 0
ACKNOWLEDGEMENTS.md

@@ -145,3 +145,4 @@ Further device support has been made with the assistance of users.  Please consi
 - [isarib01](https://github.com/isarib01) for assistance supporting Deta motion sensor lights.
 - [iDontWantAUsername](https://github.com/iDontWantAUsername) for assistance supporting Grid Connect USB charger with power socket.
 - [engusz](https://github.com/engusz) for assistance supporting Avatto curtain switches and dual switch with timers.
+- [81k5](https://github.com/81k5) for assistance supporting Aubess smart switches.

+ 1 - 1
DEVICES.md

@@ -153,7 +153,7 @@
 - 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_
+  _confirmed working with CBE smartplugs, another variant with child lock, backlight and inching switch confirmed with Aubess_
 - 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)

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

@@ -0,0 +1,156 @@
+name: Energy monitoring smartplug
+products:
+  - id: 2iepauebcvo74ujc
+    name: Aubess 20A
+primary_entity:
+  entity: switch
+  class: outlet
+  dps:
+    - id: 1
+      type: boolean
+      name: switch
+    - 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
+      name: cycle_timer
+    - id: 43
+      type: string
+      name: random_timer
+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: energy
+    name: Energy
+    dps:
+      - id: 17
+        name: sensor
+        type: integer
+        unit: Wh
+        class: total_increasing
+  - entity: sensor
+    category: diagnostic
+    class: current
+    name: Current
+    dps:
+      - id: 18
+        name: sensor
+        type: integer
+        class: measurement
+        unit: mA
+  - entity: sensor
+    category: diagnostic
+    class: power
+    name: Power
+    dps:
+      - id: 19
+        name: sensor
+        type: integer
+        class: measurement
+        unit: W
+        mapping:
+          - scale: 10
+  - entity: sensor
+    category: diagnostic
+    class: voltage
+    name: Voltage
+    dps:
+      - id: 20
+        name: sensor
+        type: integer
+        class: measurement
+        unit: V
+        mapping:
+          - scale: 10
+  - 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"
+  - entity: switch
+    name: Auto-off
+    category: config
+    icon: "mdi:camera-timer"
+    dps:
+      - id: 44
+        type: boolean
+        name: switch
+