Repository: zigpy/zha-device-handlers

Issue:
[BUG] Mismatched Quirk: A19TunableWhite without model info (and Osram RGBW Outdoor Flex)
**Describe the bug**
Someone mentioned on the Hass Discord in #zigbee that a OSRAM Lightify Outdoor Flex RGBW always got a wrong quirk: A19TunableWhite. This quirk removes the colorwheel (since #488) (which is needed for a RGBW led strip).
This happens because the quirk (https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/osram/a19twhite.py) never included any "MODELS_INFO" and the signature matches exactly between those two devices.
It's also possible that further OSRAM devices also match and thus don't show the color wheel.
A solution to this seems like to add the proper model (and manufacturer info) to the quirk.
(Or is there a reason this quirk doesn't include any model info at all? If not, perhaps a test that every quirk has at least one model in MODELS_INFO would be a good idea?)

**To Reproduce**
Steps to reproduce the behavior:
1. Bind a OSRAM Lightify Outdoor FLEX RGBW to ZHA
2. Try to change the color using Hass
3. See color wheel missing

**Expected behavior**
The OSRAM A19TunableWhite quirk doesn't apply for the RGBW light.

**Additional context**
(The user on Discord with this issue wanted to submit an issue, but it seems like that didn't happen after multiple days.)



Discussion:
It is better if it included model and manufacturer
@danielbrunt57 Do you have the device signature of the A19TunableWhite OSRAM light?
{
  "node_descriptor": "NodeDescriptor(byte1=1, byte2=64, mac_capability_flags=142, manufacturer_code=48042, maximum_buffer_size=64, maximum_incoming_transfer_size=0, server_mask=0, maximum_outgoing_transfer_size=0, descriptor_capability_field=3)",
  "endpoints": {
    "3": {
      "profile_id": 260,
      "device_type": "0x0102",
      "in_clusters": [
        "0x0000",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x0008",
        "0x0300",
        "0x0b04",
        "0xfc0f"
      ],
      "out_clusters": [
        "0x0019"
      ]
    }
  },
  "manufacturer": "OSRAM",
  "model": "LIGHTIFY A19 Tunable White",
  "class": "zhaquirks.osram.a19twhite.A19TunableWhite"
}

Thanks,
Daniel

From: TheJulianJES <notifications@github.com>
Sent: October 25, 2020 9:10 AM
To: zigpy/zha-device-handlers <zha-device-handlers@noreply.github.com>
Cc: Daniel Brunt <daniel@brunt.ca>; Mention <mention@noreply.github.com>
Subject: Re: [zigpy/zha-device-handlers] [BUG] Mismatched Quirk: A19TunableWhite without model info (and Osram RGBW Outdoor Flex) (#536)


@danielbrunt57<https://github.com/danielbrunt57> Do you have the device signature of the A19TunableWhite OSRAM light?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://github.com/zigpy/zha-device-handlers/issues/536#issuecomment-716171799>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AL4JU3LIFBYVKPRKWVECJWDSMREWHANCNFSM4S5I2A7A>.


Resolving patch:
diff --git a/zhaquirks/osram/a19twhite.py b/zhaquirks/osram/tunablewhite.py
similarity index 82%
rename from zhaquirks/osram/a19twhite.py
rename to zhaquirks/osram/tunablewhite.py
--- a/zhaquirks/osram/a19twhite.py
+++ b/zhaquirks/osram/tunablewhite.py
@@ -1,4 +1,4 @@
-"""Osram A19 tunable white device."""
+"""Osram tunable white device."""
 from zigpy.profiles import zha
 from zigpy.quirks import CustomDevice, CustomCluster
 from zigpy.zcl.clusters.general import (
@@ -13,8 +13,15 @@
 from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
 from zigpy.zcl.clusters.lighting import Color
 
-from . import OsramLightCluster
-from ..const import DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, OUTPUT_CLUSTERS, PROFILE_ID
+from . import OsramLightCluster, OSRAM
+from ..const import (
+    DEVICE_TYPE,
+    ENDPOINTS,
+    INPUT_CLUSTERS,
+    OUTPUT_CLUSTERS,
+    PROFILE_ID,
+    MODELS_INFO,
+)
 
 
 class OsramColorCluster(CustomCluster, Color):
@@ -23,13 +30,17 @@ class OsramColorCluster(CustomCluster, Color):
     _CONSTANT_ATTRIBUTES = {0x400A: 16, 0x400C: 370}
 
 
-class A19TunableWhite(CustomDevice):
-    """Osram A19 tunable white device."""
+class OsramTunableWhite(CustomDevice):
+    """Osram tunable white device."""
 
     signature = {
         # <SimpleDescriptor endpoint=3 profile=260 device_type=258
         # device_version=2 input_clusters=[0, 3, 4, 5, 6, 8, 768, 64527]
         # output_clusters=[25]>
+        MODELS_INFO: [
+            (OSRAM, "LIGHTIFY A19 Tunable White"),
+            (OSRAM, "LIGHTIFY RT Tunable White"),
+        ],
         ENDPOINTS: {
             3: {
                 PROFILE_ID: zha.PROFILE_ID,
@@ -47,7 +58,7 @@ class A19TunableWhite(CustomDevice):
                 ],
                 OUTPUT_CLUSTERS: [Ota.cluster_id],
             }
-        }
+        },
     }
 
     replacement = {


Test patch: