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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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