Selaa lähdekoodia

Add smartplug with child lock, initial state and light control.

The same as smartplugv2_energyv2, but without the energy monitoring.

Issue #1277 (SX1 relay socket)
Jason Rumney 2 vuotta sitten
vanhempi
commit
9c898e55a1

+ 1 - 0
ACKNOWLEDGEMENTS.md

@@ -431,3 +431,4 @@ Further device support has been made with the assistance of users.  Please consi
 - [mhackdo18](https://github.com/mhackdo18) for assisting with support for YP Pet feeder.
 - [magomao](https://github.com/magomao) for assisting with support for Vivion air conditioners.
 - [palkoarpad85](https://github.com/palkoarpad85) for assisting with support for Klarstein Wonderwall heaters.
+- [MJW911](https://github.com/MJW911) for assisting with support for SX1 smartplugs.

+ 2 - 0
DEVICES.md

@@ -371,6 +371,8 @@ of device.
   _confirmed working with CBE smartplugs, another variant with child lock, backlight and inching switch confirmed with Aubess and Elivco, and another variant with Gosund UP111-RTL_
 - Generic smartplug with some additional encoded schedule info.
   _confirmed working as a simple switch and timer with Kashimura KJ-173_
+- Generic smartplug without power monitoring but with most other features (initial state setting, light options, child lock)
+  _confirmed working with SX1 relay socket_
 - Generic double switch with timers (confirmed with Living dual switch and another v2 variant with Avatto dual switch)
 - Generic triple and quad switches (confirmed with Songam wall switches)
 - Generic triple and quad switches with timers (confirmed with Pearl Xystec USB hub).

+ 74 - 0
custom_components/tuya_local/devices/smartplug_with_childlock.yaml

@@ -0,0 +1,74 @@
+name: Smartplug
+products:
+  - id: r9xep1xwyoubglpn
+    name: SX1 reelay switch
+primary_entity:
+  entity: switch
+  class: outlet
+  dps:
+    - id: 1
+      type: boolean
+      name: switch
+    - id: 42
+      type: string
+      name: cyclic_schedule
+    - id: 43
+      type: string
+      name: random_schedule
+    - id: 44
+      type: string
+      name: inching
+secondary_entities:
+  - entity: number
+    category: config
+    icon: "mdi:timer"
+    name: Timer
+    dps:
+      - id: 9
+        type: integer
+        name: value
+        unit: min
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+  - entity: select
+    name: Initial state
+    icon: "mdi:toggle-switch"
+    category: config
+    dps:
+      - id: 38
+        type: string
+        name: option
+        mapping:
+          - dps_val: "off"
+            value: "Off"
+          - dps_val: "on"
+            value: "On"
+          - dps_val: memory
+            value: Last state
+  - entity: select
+    name: Light mode
+    icon: "mdi:television-ambient-light"
+    category: config
+    dps:
+      - id: 40
+        type: string
+        name: option
+        mapping:
+          - dps_val: relay 
+            value: State
+          - dps_val: pos
+            value: Position
+          - dps_val: none
+            value: "Off"
+  - entity: lock
+    name: Child lock
+    icon: "mdi:hand-back-right-off"
+    category: config
+    dps:
+      - id: 41
+        type: boolean
+        name: lock