Repository: zigpy/zha-device-handlers

Issue:
[BUG] Osram switch mini
**Describe the bug**
Adding a OSRAM Lightify Switch Mini to my network is not working out after quirk was added some time ago.

Before quirk: I picked up zha_events.

After quirk: The remote switches everything(switched bulbs cover) in my network on and off.


 

**To Reproduce**
Steps to reproduce the behavior:
Removed remote, deletes entries from zha.storage and other HA files I could find the remote.

Device signature:
{
  "node_descriptor": "NodeDescriptor(byte1=2, byte2=64, mac_capability_flags=128, manufacturer_code=4364, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=0, maximum_outgoing_transfer_size=82, descriptor_capability_field=0)",
  "endpoints": {},
  "manufacturer": "OSRAM",
  "model": "Lightify Switch Mini",
  "class": "zhaquirks.osram.switchmini.OsramSwitchMini"
}

Manage cluster is empty.
![osrammini](https://user-images.githubusercontent.com/11892538/94000737-deea2f80-fd97-11ea-88a2-83301b6584a0.png)

**Expected behavior**
A remote that switches the stuff I want, not everything(via zha_event for my usage)

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
[osramminiadd.txt](https://github.com/zigpy/zha-device-handlers/files/5267371/osramminiadd.txt)



Discussion:
I tried further and after removing the quirks file for the switch I got a working remote again catching the zha_events.

![switch mini no quirks](https://user-images.githubusercontent.com/11892538/94408360-f9941e00-0174-11eb-9dd2-137d1279cf1f.png)

Is there a setting to choose not to use a quirks, besides removing the file from the site-packages?

I have added the debug log from this join

[osramswitchmini.txt](https://github.com/zigpy/zha-device-handlers/files/5290934/osramswitchmini.txt)


@dmulcahey that Quirk indeed doesn't have any `replacement` https://github.com/zigpy/zha-device-handlers/blob/1f0bd91c746afe3d1576954ceefd74ee2e37fc63/zhaquirks/osram/switchmini.py#L45 which would cause the new endpoints to be empty. 

Resolving patch:
diff --git a/zhaquirks/osram/switchmini.py b/zhaquirks/osram/switchmini.py
--- a/zhaquirks/osram/switchmini.py
+++ b/zhaquirks/osram/switchmini.py
@@ -112,6 +112,9 @@ class OsramSwitchMini(CustomDevice):
         },
     }
 
+    replacement = {**signature}
+    replacement.pop(MODELS_INFO)
+
     device_automation_triggers = {
         (SHORT_PRESS, BUTTON_1): {COMMAND: COMMAND_ON, ENDPOINT_ID: 1},
         (LONG_PRESS, BUTTON_1): {COMMAND: COMMAND_STEP_ON_OFF, ENDPOINT_ID: 1},


Test patch:
diff --git a/tests/test_quirks.py b/tests/test_quirks.py
new file mode 100644
--- /dev/null
+++ b/tests/test_quirks.py
@@ -0,0 +1,23 @@
+"""General quirk tests."""
+
+import pytest
+import zigpy.quirks as zq
+import zhaquirks  # noqa: F401, E402
+from zhaquirks.const import ENDPOINTS
+
+ALL_QUIRK_CLASSES = (
+    quirk
+    for manufacturer in zq._DEVICE_REGISTRY._registry.values()
+    for model in manufacturer.values()
+    for quirk in model
+)
+
+
+@pytest.mark.parametrize("quirk", ALL_QUIRK_CLASSES)
+def test_quirk_replacements(quirk):
+    """Test all quirks have a replacement."""
+
+    assert quirk.signature
+    assert quirk.replacement
+
+    assert quirk.replacement[ENDPOINTS]