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

feat(yuhome_laundry_rack): add Yu Prime (#6307)

Adds the YU HOME Yu Prime to `yuhome_laundry_rack`. The Prime is the
basic model: lift and light,
no UV, drying or voice.

Product id: `9yqs0oycooefxxwz`

LOCAL DPS from the config flow:

```
{"1": false, "2": "stop", "3": 0, "4": false, "9": "stop", "18": 0}
```

Changes:
- DPs 5, 6, 7 and 104 are now optional and hidden when unavailable, as
the timers already are.
- DP 3 is also mapped as `current_position`. It streams the live
position while the rack moves
(about 5 updates a second; 0 = fully up), so HA shows the real position,
and a state instead of
`unknown`, when the rack stops partway. On the Prime, writes to DP 3 are
ignored; I left
`position` in place because the data model says `rw` and it may work on
the Turbo.
- DP 18 gets a `description`: an obstacle rebound on the Prime sets it
to 2 (fault2) for about
  0.3 s, then back to 0.

Tested on a Prime with HA 2026.9.3 and Tuya Local 2026.9.2: up, down,
stop, light, the position
stream, and a deliberate obstacle rebound, while moving it from HA, the
IR remote and Smart Life.
`yamllint`, `ruff` and `pytest` pass locally.

I prepared this with Claude Code, and checked the config and the test
results against the device
myself.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: rmschots <2806802+rmschots@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Roel Mangelschots 7 часов назад
Родитель
Сommit
39dc6e619e
1 измененных файлов с 59 добавлено и 0 удалено
  1. 59 0
      custom_components/tuya_local/devices/yuhome_laundry_rack.yaml

+ 59 - 0
custom_components/tuya_local/devices/yuhome_laundry_rack.yaml

@@ -3,6 +3,9 @@ products:
   - id: ttawi9yohqflpt4a
     manufacturer: YU HOME
     model: Yu Turbo
+  - id: 9yqs0oycooefxxwz
+    manufacturer: YU HOME
+    model: Yu Prime
 entities:
   - entity: switch
     dps:
@@ -30,6 +33,14 @@ entities:
           max: 100
         mapping:
           - invert: true
+      - id: 3
+        type: integer
+        name: current_position
+        range:
+          min: 0
+          max: 100
+        mapping:
+          - invert: true
       - id: 9
         type: string
         name: action
@@ -70,32 +81,72 @@ entities:
             available: dual_led_model
   - entity: switch
     translation_key: uv_sterilization
+    hidden: unavailable
     dps:
       - id: 5
         type: boolean
+        optional: true
         name: switch
+      - id: 5
+        type: boolean
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
   - entity: switch
     name: Wind dry
     icon: "mdi:weather-windy"
+    hidden: unavailable
     dps:
       - id: 6
         type: boolean
+        optional: true
         name: switch
+      - id: 6
+        type: boolean
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
   - entity: switch
     name: Hot dry
     icon: "mdi:heat-wave"
+    hidden: unavailable
     dps:
       - id: 7
         type: boolean
+        optional: true
         name: switch
+      - id: 7
+        type: boolean
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
   - entity: switch
     name: Voice control
     icon: "mdi:microphone"
     category: config
+    hidden: unavailable
     dps:
       - id: 104
         type: boolean
+        optional: true
         name: switch
+      - id: 104
+        type: boolean
+        optional: true
+        name: available
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
   - entity: select
     name: Disinfection timer
     translation_key: timer
@@ -302,6 +353,14 @@ entities:
       - id: 18
         type: bitfield
         name: fault_code
+      - id: 18
+        type: bitfield
+        name: description
+        mapping:
+          - dps_val: 0
+            value: ok
+          - dps_val: 2
+            value: Obstacle
   - entity: select
     name: Disinfection time
     translation_key: timer