ZHA devices incorrectly configured, wrong quirk

I currently have 3 thirdreality smart buttons. Two of them are generally working as expected. I have deleted and reset and repaired the one that is not working as expected several times without luck. After a lot of digging and messing around, I think I have found the issue. It appears that the problem device is not being configured with the thirdreality quirks anymore. I believe it was when I first set it up, but after binding to a bulb and then unbinding, it stopped behaving as expected.

The main behavior difference is that the ZHA events recorded for the problem device are generic like “Toggle event was fired” rather than the expected “Remote Button Short Press event was fired”. This makes it so the events cannot be used in automations normally without the fancy event monitor to look for specific ZHA events on the bus.

After a lot of digging, I found that the problematic device has a generic quirk listed, rather than the proper thirdreality quirk in the signature section of the device.

Here are examples of the correct signature followed by the incorrect signature:

{
  "node_descriptor": {
    "logical_type": 2,
    "complex_descriptor_available": 0,
    "user_descriptor_available": 0,
    "reserved": 0,
    "aps_flags": 0,
    "frequency_band": 8,
    "mac_capability_flags": 128,
    "manufacturer_code": 4659,
    "maximum_buffer_size": 66,
    "maximum_incoming_transfer_size": 66,
    "server_mask": 10752,
    "maximum_outgoing_transfer_size": 66,
    "descriptor_capability_field": 0
  },
  "endpoints": {
    "1": {
      "profile_id": "0x0104",
      "device_type": "0x0006",
      "input_clusters": [
        "0x0000",
        "0x0001",
        "0x0012"
      ],
      "output_clusters": [
        "0x0006",
        "0x0008",
        "0x0019"
      ]
    }
  },
  "manufacturer": "Third Reality, Inc",
  "model": "3RSB22BZ",
  "class": "zhaquirks.thirdreality.button.Button"
}
{
  "node_descriptor": {
    "logical_type": 2,
    "complex_descriptor_available": 0,
    "user_descriptor_available": 0,
    "reserved": 0,
    "aps_flags": 0,
    "frequency_band": 8,
    "mac_capability_flags": 128,
    "manufacturer_code": 4659,
    "maximum_buffer_size": 74,
    "maximum_incoming_transfer_size": 404,
    "server_mask": 10752,
    "maximum_outgoing_transfer_size": 404,
    "descriptor_capability_field": 0
  },
  "endpoints": {
    "1": {
      "profile_id": "0x0104",
      "device_type": "0x0006",
      "input_clusters": [
        "0x0000",
        "0x0001",
        "0x0012",
        "0xff01"
      ],
      "output_clusters": [
        "0x0006",
        "0x0008",
        "0x0019"
      ]
    }
  },
  "manufacturer": "Third Reality, Inc",
  "model": "3RSB22BZ",
  "class": "zigpy.device.Device"
}

A big problem that seems to be tripping me up is that you cannot truly delete and clean out a device to fully reset it up. There is still a lot of stuff left behind.

After quite a bit of frustration, I think I have now realized that this may be causing a similar issue with a thirdreality temperature sensor, and a third reality light bulb. This configuration error cannot be reset by removing and repairing, and it is preventing me from applying any firmware updates.

Does anyone know how to resolve issues like this?

Hi, have you checked this guide on how to get a custom quirk added for a device? If you have the quirk for the well working devices you could probably set that up for the other one as well (assuming it is similar enough):

This looks promising, but searching for the correct quirk actually brought up another post with the same exact problem. I guess I was searching wrong…

There is a thread with the same problem. Maybe the device is in amazon echo mode? I will see if I can get this fixed and report back.

This other solution regarding the Amazon Echo vs Home Assistant mode did not help me. I’m am trying to figure out how to force a quirk to load, but it is not clear to me how to force the device to use it. I mean, the quirk is already available, and I could add it as a custom file, but I do not see how to force it to be used. The instructions seem helpful if you have a new quirk that needs to be used, but not to override an erroneously applied quirk.

Fundamentally, it appears that ZHA is incapable of truly deleting and clearing out old devices so that they can be cleanly paired again. Or, maybe I am wrong and these thirdreality devices are problematic in some way.

I have one single thirdreality temperature sensor: 3RTHS0224Z which has been on/off problematic, and I have never been able to get it to do a firmware update. I just noticed that in it signature it is using the generic quirk rather than the quirk found here: zha-device-handlers/zhaquirks/thirdreality/temperature_sensor.py at 928268cca5d22a048e72d45ae1c24a1b6dd92a9c · zigpy/zha-device-handlers · GitHub

Maybe the next step is to log a bug in ZHA?