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

Create smartplug_usb_childlock.yaml

Product name: Plug In WiFi Smart Socket with USB
Product id: ynz9qmnmnsciccyc

Where to buy: https://www.tlc-direct.co.uk/Products/ECSPSP.html

close to smartplug_with_childlock.yaml but this change adds the second outlet with corresponding countdown timer

dps:

{
  "result": {
    "model": "{\"modelId\":\"000004qxv4\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"switch_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"149\"},\"name\":\"开关1\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":2,\"accessMode\":\"rw\",\"code\":\"switch_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"149\"},\"name\":\"开关2\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":9,\"accessMode\":\"rw\",\"code\":\"countdown_1\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"128\"},\"name\":\"开关1倒计时\",\"typeSpec\":{\"type\":\"value\",\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},{\"abilityId\":10,\"accessMode\":\"rw\",\"code\":\"countdown_2\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"128\"},\"name\":\"开关2倒计时\",\"typeSpec\":{\"type\":\"value\",\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},{\"abilityId\":38,\"accessMode\":\"rw\",\"code\":\"relay_status\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zhuangtai\",\"attribute\":\"640\"},\"name\":\"设备重启状态设置\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"off\",\"on\",\"memory\"]}},{\"abilityId\":40,\"accessMode\":\"rw\",\"code\":\"light_mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"tcl_function_light\",\"attribute\":\"128\"},\"name\":\"指示灯模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"relay\",\"pos\",\"none\"]}},{\"abilityId\":41,\"accessMode\":\"rw\",\"code\":\"child_lock\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"128\"},\"name\":\"童锁\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":42,\"accessMode\":\"rw\",\"code\":\"cycle_time\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time3\",\"attribute\":\"128\"},\"name\":\"循环定时\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},{\"abilityId\":43,\"accessMode\":\"rw\",\"code\":\"random_time\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"attribute\":\"128\"},\"name\":\"随机定时\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},{\"abilityId\":44,\"accessMode\":\"rw\",\"code\":\"switch_inching\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"144\"},\"name\":\"点动开关\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}}]}]}"
  },
  "success": true,
  "t": 1728851864362,
  "tid": "ffe5a76289a211efb77736033862a1ba"
}
Stu 1 год назад
Родитель
Сommit
7d0a181a07
1 измененных файлов с 95 добавлено и 0 удалено
  1. 95 0
      custom_components/tuya_local/devices/smartplug_usb_childlock.yaml

+ 95 - 0
custom_components/tuya_local/devices/smartplug_usb_childlock.yaml

@@ -0,0 +1,95 @@
+name: Plug In WiFi Smart Socket with USB
+products:
+  - id: ynz9qmnmnsciccyc
+    name: Plug In WiFi Smart Socket with USB
+primary_entity:
+  entity: switch
+  class: outlet
+  name: USB
+  icon: "mdi:usb"
+  dps:
+    - id: 1
+      type: boolean
+      name: switch
+secondary_entities:
+  - entity: switch
+    name: AC Outlet
+    class: outlet
+    dps:
+      - id: 2
+        type: boolean
+        name: switch
+      - id: 42
+        type: string
+        name: cyclic_schedule
+      - id: 43
+        type: string
+        name: random_schedule
+      - id: 44
+        type: string
+        name: inching
+  - entity: number
+    category: config
+    name: USB Countdown Timer
+    dps:
+      - id: 9
+        type: integer
+        name: value
+        unit: min
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+  - entity: number
+    category: config
+    name: AC Outlet Countdown Timer
+    dps:
+      - id: 10
+        type: integer
+        name: value
+        unit: min
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+  - entity: select
+    translation_key: initial_state
+    category: config
+    dps:
+      - id: 38
+        type: string
+        name: option
+        mapping:
+          - dps_val: "off"
+            value: "off"
+          - dps_val: "on"
+            value: "on"
+          - dps_val: memory
+            value: Remember last state
+  - entity: select
+    name: Indicator light mode
+    icon: "mdi:television-ambient-light"
+    category: config
+    dps:
+      - id: 40
+        type: string
+        name: option
+        mapping:
+          - dps_val: relay
+            value: Indicate switch on/off state
+          - dps_val: pos
+            value: Indicate inverted switch state
+          - dps_val: none
+            value: "Off"
+  - entity: lock
+    translation_key: child_lock
+    icon: "mdi:account-lock"
+    category: config
+    dps:
+      - id: 41
+        type: boolean
+        name: lock