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

fix(mixed lights): avoid using main light switch as available indicator

It has since been found that lights that use individual switches along
with a main switch on dp 20 will automatically switch dp 20 in sync
with changes on individual switches. So it is not necessary to force
the user to switch the main dp 20 switch on manually before
controlling the individual lights.

This change covers such devices:
Devices using mixed_rgbcw (dp51) including individual switching:
  - depuley_smart_ceiling_fan
  - keyun_rgb_ceilingfan
  - ledvance_smart_plab100x25b
  - orison_chanfok_neo_fan_light (previously changed but cleaned up to
                                  be consistent with others)
Devices using separate dps for white and color switches:
  - lumary_a1_ceilingfanlight
  - lumary_b2?ceilingfanlight
  - npdvl01_ceilingfanlight
  - vjulesv_sk17_galaxyprojector

Issue #5064
Jason Rumney 1 день назад
Родитель
Сommit
2625438f80

+ 2 - 5
custom_components/tuya_local/devices/depuley_smart_ceiling_fan.yaml

@@ -15,7 +15,7 @@ entities:
   - entity: light
   - entity: light
     dps:
     dps:
       - id: 20
       - id: 20
-        name: available
+        name: power
         type: boolean
         type: boolean
       - id: 51
       - id: 51
         type: base64
         type: base64
@@ -24,7 +24,7 @@ entities:
         name: switch
         name: switch
         mapping:
         mapping:
           - dps_val: null
           - dps_val: null
-            value_mirror: available
+            value_mirror: power
       - id: 21
       - id: 21
         name: work_mode
         name: work_mode
         type: string
         type: string
@@ -86,9 +86,6 @@ entities:
   - entity: light
   - entity: light
     translation_key: backlight
     translation_key: backlight
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 51
       - id: 51
         name: switch
         name: switch
         type: base64
         type: base64

+ 3 - 5
custom_components/tuya_local/devices/keyun_rgb_ceilingfan.yaml

@@ -33,6 +33,7 @@ entities:
   - entity: switch
   - entity: switch
     name: Lights
     name: Lights
     icon: "mdi:lightbulb-multiple"
     icon: "mdi:lightbulb-multiple"
+    category: config
     dps:
     dps:
       - id: 20
       - id: 20
         type: boolean
         type: boolean
@@ -41,7 +42,7 @@ entities:
     dps:
     dps:
       - id: 20
       - id: 20
         type: boolean
         type: boolean
-        name: available
+        name: power
       - id: 51
       - id: 51
         type: base64
         type: base64
         optional: true
         optional: true
@@ -49,7 +50,7 @@ entities:
         name: switch
         name: switch
         mapping:
         mapping:
           - dps_val: null
           - dps_val: null
-            value_mirror: available
+            value_mirror: power
       - id: 21
       - id: 21
         name: work_mode
         name: work_mode
         type: string
         type: string
@@ -107,9 +108,6 @@ entities:
   - entity: light
   - entity: light
     translation_key: backlight
     translation_key: backlight
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 51
       - id: 51
         type: base64
         type: base64
         optional: true
         optional: true

+ 5 - 4
custom_components/tuya_local/devices/ledvance_smart_plabl100x25b.yaml

@@ -11,6 +11,7 @@ products:
 entities:
 entities:
   - entity: switch
   - entity: switch
     icon: "mdi:lightbulb-multiple"
     icon: "mdi:lightbulb-multiple"
+    category: config
     dps:
     dps:
       - id: 20
       - id: 20
         type: boolean
         type: boolean
@@ -20,7 +21,7 @@ entities:
     dps:
     dps:
       - id: 20
       - id: 20
         type: boolean
         type: boolean
-        name: available
+        name: power
       - id: 51
       - id: 51
         type: base64
         type: base64
         mask: "000100000000000000000000"
         mask: "000100000000000000000000"
@@ -29,7 +30,7 @@ entities:
         name: switch
         name: switch
         mapping:
         mapping:
           - dps_val: null
           - dps_val: null
-            value_mirror: available
+            value_mirror: power
       - id: 21
       - id: 21
         type: string
         type: string
         optional: true
         optional: true
@@ -84,7 +85,7 @@ entities:
     dps:
     dps:
       - id: 20
       - id: 20
         type: boolean
         type: boolean
-        name: available
+        name: power
       - id: 51
       - id: 51
         type: base64
         type: base64
         mask: "000200000000000000000000"
         mask: "000200000000000000000000"
@@ -93,7 +94,7 @@ entities:
         name: switch
         name: switch
         mapping:
         mapping:
           - dps_val: null
           - dps_val: null
-            value_mirror: available
+            value_mirror: power
       - id: 21
       - id: 21
         type: string
         type: string
         optional: true
         optional: true

+ 2 - 20
custom_components/tuya_local/devices/lumary_a1_ceilingfanlight.yaml

@@ -224,18 +224,9 @@ entities:
           - target_range:
           - target_range:
               min: 2700
               min: 2700
               max: 6500
               max: 6500
-      - id: 20
-        name: available
-        type: boolean
-        mapping:
-          - dps_val: true
-            constraint: main_switch
-            conditions:
-              - dps_val: false
-                value: false
       - id: 119
       - id: 119
         type: boolean
         type: boolean
-        name: main_switch
+        name: available
   - entity: light
   - entity: light
     name: Color
     name: Color
     category: config
     category: config
@@ -262,18 +253,9 @@ entities:
             range:
             range:
               min: 0
               min: 0
               max: 1000
               max: 1000
-      - id: 20
-        name: available
-        type: boolean
-        mapping:
-          - dps_val: true
-            constraint: main_switch
-            conditions:
-              - dps_val: false
-                value: false
       - id: 119
       - id: 119
         type: boolean
         type: boolean
-        name: main_switch
+        name: available
   - entity: text
   - entity: text
     translation_key: scene
     translation_key: scene
     category: config
     category: config

+ 1 - 9
custom_components/tuya_local/devices/lumary_b2_ceilingfanlight.yaml

@@ -9,15 +9,13 @@ entities:
     name: Lights
     name: Lights
     icon: "mdi:lightbulb-multiple"
     icon: "mdi:lightbulb-multiple"
     category: config
     category: config
+    hidden: true
     dps:
     dps:
       - id: 20
       - id: 20
         type: boolean
         type: boolean
         name: switch
         name: switch
   - entity: light
   - entity: light
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 107
       - id: 107
         type: boolean
         type: boolean
         name: switch
         name: switch
@@ -52,9 +50,6 @@ entities:
   - entity: light
   - entity: light
     name: RGB
     name: RGB
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 108
       - id: 108
         type: boolean
         type: boolean
         name: switch
         name: switch
@@ -215,9 +210,6 @@ entities:
   - entity: light
   - entity: light
     translation_key: nightlight
     translation_key: nightlight
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 143
       - id: 143
         type: boolean
         type: boolean
         name: switch
         name: switch

+ 0 - 6
custom_components/tuya_local/devices/npdvl01_ceilingfanlight.yaml

@@ -100,9 +100,6 @@ entities:
   - entity: light
   - entity: light
     name: White
     name: White
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 22
       - id: 22
         type: integer
         type: integer
         name: brightness
         name: brightness
@@ -125,9 +122,6 @@ entities:
   - entity: light
   - entity: light
     name: Color
     name: Color
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 102
       - id: 102
         type: boolean
         type: boolean
         name: switch
         name: switch

+ 1 - 3
custom_components/tuya_local/devices/orison_chanfok_neo_fan_light.yaml

@@ -30,6 +30,7 @@ entities:
   - entity: switch
   - entity: switch
     name: Lights
     name: Lights
     icon: "mdi:lightbulb-multiple"
     icon: "mdi:lightbulb-multiple"
+    category: config
     dps:
     dps:
       - id: 20
       - id: 20
         type: boolean
         type: boolean
@@ -97,9 +98,6 @@ entities:
   - entity: light
   - entity: light
     translation_key: backlight
     translation_key: backlight
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: power
       - id: 51
       - id: 51
         type: base64
         type: base64
         mask: "000200000000000000000000"
         mask: "000200000000000000000000"

+ 0 - 9
custom_components/tuya_local/devices/vjulesv_sk17_galaxyprojector.yaml

@@ -17,9 +17,6 @@ entities:
   - entity: light
   - entity: light
     name: White
     name: White
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 63
       - id: 63
         type: boolean
         type: boolean
         name: switch
         name: switch
@@ -70,9 +67,6 @@ entities:
   - entity: light
   - entity: light
     name: Color
     name: Color
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 52
       - id: 52
         type: boolean
         type: boolean
         name: switch
         name: switch
@@ -99,9 +93,6 @@ entities:
   - entity: light
   - entity: light
     translation_key: laser
     translation_key: laser
     dps:
     dps:
-      - id: 20
-        type: boolean
-        name: available
       - id: 53
       - id: 53
         type: boolean
         type: boolean
         name: switch
         name: switch