Zigbee downlight works with original Hue hub, not ZHA after pairing

I’ve scoured the net but simply cannot figure this one out. If anyone can help please.

I’ve have two different Zigbee devices doing similar things: Downlight bulbs & a LED Dimmer (MOES TS0505B and Tuya S1-B WZ). Both successfully pair with ZHA but then I cannot control them. All controls become available briefly after pairing, but then almost immediately go offline. My main issue now is the MOES TS0505B Downlights. I bought 4 and the first two I’m testing is now doing this…

The weird thing is, after ZHA failed to control them, I reset & paired them with the original v1 Hue hub and they work flawlessly. Dim, CT and RGB. I then reset them and pair with ZHA. They finish the interview and become available, but I cannot control them. I just get a service call error from HA.

I’m using a SkyConnect dongle, running HA OS in a Proxmox container. All my other Zigbee devices work perfectly fine (Hue bulbs, Gledopto bulbs, other bulb brands and numerous battery devices).

Does anyone have an idea what could be causing this? I’ll share any logs/info that could help.

HA Logs:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/zha/light.py:471
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 5:05:48 PM (7 occurrences)
Last logged: 5:53:36 PM

[139985091503632] Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
[139984840420624] Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1965, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2005, in _execute_service
    return await cast(
           ^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 848, in entity_service_call
    response_data = task.result()  # pop exception if have
                    ^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1192, in async_request_call
    return await coro
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 593, in async_handle_light_off_service
    await light.async_turn_off(**filter_turn_off_params(light, params))
  File "/usr/src/homeassistant/homeassistant/components/zha/light.py", line 471, in async_turn_off
    result = await self._on_off_cluster_handler.off()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/util.py", line 132, in retry
    return await func()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/zcl/__init__.py", line 375, in request
    return await self._endpoint.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/endpoint.py", line 253, in request
    return await self.device.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 293, in request
    await self._application.request(
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 824, in request
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 831, in send_packet
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>

Zigbee Diagnostics file:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.7.2",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.4",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Africa/Johannesburg",
    "os_name": "Linux",
    "os_version": "6.1.34",
    "supervisor": "2023.07.1",
    "host_os": "Home Assistant OS 10.3",
    "docker_version": "23.0.6",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "version": "1.32.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "eskom_loadshedding": {
      "version": "1.1.2",
      "requirements": []
    },
    "xiaomi_miot": {
      "version": "0.7.10",
      "requirements": [
        "construct==2.10.56",
        "python-miio>=0.5.6",
        "micloud>=0.3"
      ]
    },
    "localtuya": {
      "version": "5.0.0",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "after_dependencies": [
      "onboarding",
      "usb"
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga",
      "@puddly"
    ],
    "config_flow": true,
    "dependencies": [
      "file_upload"
    ],
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp"
    ],
    "requirements": [
      "bellows==0.35.8",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.101",
      "zigpy-deconz==0.21.0",
      "zigpy==0.56.2",
      "zigpy-xbee==0.18.1",
      "zigpy-zigate==0.11.0",
      "zigpy-znp==0.11.3"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "1A86",
        "pid": "55D4",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus v2"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*zigstar*",
        "known_devices": [
          "ZigStar Coordinators"
        ]
      },
      {
        "vid": "1CF1",
        "pid": "0030",
        "description": "*conbee*",
        "known_devices": [
          "Conbee II"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8A2A",
        "description": "*zigbee*",
        "known_devices": [
          "Nortek HUSBZB-1"
        ]
      },
      {
        "vid": "0403",
        "pid": "6015",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate+"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      },
      {
        "type": "_zigate-zigbee-gateway._tcp.local.",
        "name": "*zigate*"
      },
      {
        "type": "_zigstar_gw._tcp.local.",
        "name": "*zigstar*"
      },
      {
        "type": "_slzb-06._tcp.local.",
        "name": "slzb-06*"
      }
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 29297,
    "manufacturer": "_TZ3210_s9lumfhn",
    "model": "TS0505B",
    "name": "_TZ3210_s9lumfhn TS0505B",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4107,
    "power_source": "Mains",
    "lqi": 160,
    "rssi": -60,
    "last_seen": "2023-07-15T17:09:38",
    "available": true,
    "device_type": "Router",
    "signature": {
      "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 142>, manufacturer_code=4107, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
      "endpoints": {
        "1": {
          "profile_id": "0x0104",
          "device_type": "0x010d",
          "input_clusters": [
            "0x0000",
            "0x0003",
            "0x0004",
            "0x0005",
            "0x0006",
            "0x0008",
            "0x000a",
            "0x0300",
            "0x1000",
            "0x1888",
            "0xffee"
          ],
          "output_clusters": [
            "0x0019",
            "0x1000",
            "0xffee"
          ]
        }
      },
      "manufacturer": "_TZ3210_s9lumfhn",
      "model": "TS0505B"
    },
    "active_coordinator": false,
    "entities": [
      {
        "entity_id": "button.tz3210_s9lumfhn_ts0505b_identify",
        "name": "_TZ3210_s9lumfhn TS0505B"
      },
      {
        "entity_id": "light.tz3210_s9lumfhn_ts0505b_light",
        "name": "_TZ3210_s9lumfhn TS0505B"
      },
      {
        "entity_id": "number.tz3210_s9lumfhn_ts0505b_start_up_current_level",
        "name": "_TZ3210_s9lumfhn TS0505B"
      },
      {
        "entity_id": "number.tz3210_s9lumfhn_ts0505b_start_up_color_temperature",
        "name": "_TZ3210_s9lumfhn TS0505B"
      },
      {
        "entity_id": "select.tz3210_s9lumfhn_ts0505b_start_up_behavior",
        "name": "_TZ3210_s9lumfhn TS0505B"
      }
    ],
    "neighbors": [],
    "routes": [],
    "endpoint_names": [
      {
        "name": "EXTENDED_COLOR_LIGHT"
      }
    ],
    "user_given_name": null,
    "device_reg_id": "216041f3ea63476d82951aeff19ce386",
    "area_id": null,
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "EXTENDED_COLOR_LIGHT",
          "id": 269
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZ3210_s9lumfhn"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS0505B"
              }
            },
            "unsupported_attributes": {}
          },
          "0x0003": {
            "endpoint_attribute": "identify",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x1888": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0004": {
            "endpoint_attribute": "groups",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0005": {
            "endpoint_attribute": "scenes",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0006": {
            "endpoint_attribute": "on_off",
            "attributes": {
              "0x0000": {
                "attribute_name": "on_off",
                "value": 1
              },
              "0x4003": {
                "attribute_name": "start_up_on_off",
                "value": 255
              }
            },
            "unsupported_attributes": {}
          },
          "0x0008": {
            "endpoint_attribute": "level",
            "attributes": {
              "0x0000": {
                "attribute_name": "current_level",
                "value": 127
              },
              "0x4000": {
                "attribute_name": "start_up_current_level",
                "value": 127
              }
            },
            "unsupported_attributes": {
              "0x0012": {
                "attribute_name": "on_transition_time"
              },
              "0x0013": {
                "attribute_name": "off_transition_time"
              },
              "0x0010": {
                "attribute_name": "on_off_transition_time"
              },
              "0x0011": {
                "attribute_name": "on_level"
              },
              "0x0014": {
                "attribute_name": "default_move_rate"
              }
            }
          },
          "0x0300": {
            "endpoint_attribute": "light_color",
            "attributes": {
              "0x400a": {
                "attribute_name": "color_capabilities",
                "value": 8
              },
              "0x4002": {
                "attribute_name": "color_loop_active",
                "value": 1
              },
              "0x0008": {
                "attribute_name": "color_mode",
                "value": 2
              },
              "0x400c": {
                "attribute_name": "color_temp_physical_max",
                "value": 500
              },
              "0x400b": {
                "attribute_name": "color_temp_physical_min",
                "value": 143
              },
              "0x0007": {
                "attribute_name": "color_temperature",
                "value": 143
              },
              "0x0000": {
                "attribute_name": "current_hue",
                "value": 68
              },
              "0x0001": {
                "attribute_name": "current_saturation",
                "value": 254
              },
              "0x0003": {
                "attribute_name": "current_x",
                "value": 43263
              },
              "0x0004": {
                "attribute_name": "current_y",
                "value": 21942
              },
              "0x000f": {
                "attribute_name": "options",
                "value": 0
              },
              "0x4010": {
                "attribute_name": "start_up_color_temperature",
                "value": 143
              }
            },
            "unsupported_attributes": {
              "0x4000": {
                "attribute_name": "enhanced_current_hue"
              }
            }
          },
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x1000": {
            "endpoint_attribute": "lightlink",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xffee": {
            "endpoint_attribute": "manufacturer_specific",
            "attributes": {},
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x1000": {
            "endpoint_attribute": "lightlink",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xffee": {
            "endpoint_attribute": "manufacturer_specific",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}

I think this looks like a new version of the light, it’s code is s9lumfhn, the ones confirmed workign with ZHA have different codes when cheking on blackadder https://zigbee.blakadder.com/Tuya_TS0505B.html

Thanks I also saw this. Would the correct approach be to find a suitable quirks file and add my manufacturer to it? Then create & unload to HA’s local quirks folder.

I’ve seen this one, that I guess is worth giving a go:

You indeed need a special quirk to make it work. It looks ok and replacing the type code might be the only thing needed but it is beyond my knowledge. Trying it should not harm much but make a backup of HA first. Maybe someone else knows more or you can try the HA discord zigbee thread.

I spent the last 2 hours going down the quirks rabbit hole when it dawned on me that the basic support provided by the bulb works. The necessary clusters should be fine as they work with the Hue hub (all controls & reporting, the lot), and ZHA detects and interprets them just fine (I have all the buttons, sliders & colour selectors I expect to have). The issue is after this, then something goes wrong and nothing works. The link is unstable/dropped, device becomes unavailable and no controls work.

I’m back to being stumped.

Hi - I really should have read this thread before buying 9 of these… Have you had any luck getting themto work with zha? Or even a suitable quirks file?

I’ve used this quirks file which seems to at least provide on/off for the light - this’ll be fine for my requirements. Hopefully this’ll help you too.

"""Quirk for Tuya RGB+CCT bulb."""
from zigpy.profiles import zha
from zigpy.quirks import CustomCluster, CustomDevice
from zigpy.zcl.clusters.general import (
    Basic,
    GreenPowerProxy,
    Groups,
    Identify,
    LevelControl,
    OnOff,
    Ota,
    Scenes,
    Time,
)
from zigpy.zcl.clusters.lighting import Color
from zigpy.zcl.clusters.lightlink import LightLink

from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)

from zhaquirks.tuya import (
    TuyaManufCluster,
    TuyaManufClusterAttributes
)

class TuyaRGBCCTColorCluster(CustomCluster, Color):
    """ RGB+CCT Lighting custom cluster."""

    # Set correct capabilities to ct, xy, hs
    # bulbs do not correctly report this attribute (comes back as None in Home Assistant)
    _CONSTANT_ATTRIBUTES = {0x400A: 0b11001}


class TuyaRGBCCTLight(CustomDevice):
    """ RGB+CCT Lighting device."""

    signature = {
        MODELS_INFO: [("_TZ3210_s9lumfhn", "TS0505B")],
        ENDPOINTS: {
            1: {
                # <SimpleDescriptor endpoint=1 profile=260 device_type=269
                # device_version=1
                # input_clusters=[0, 3, 4, 5, 6, 8, 768, 4096, 61184]
                # output_clusters=[10, 25]
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.EXTENDED_COLOR_LIGHT,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    Color.cluster_id,
                    LightLink.cluster_id,
                    TuyaManufCluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Time.cluster_id,
                    Ota.cluster_id
                ],
            },
            242: {
                # <SimpleDescriptor endpoint=242 profile=41440 device_type=97
                # device_version=0
                # input_clusters=[]
                # output_clusters=[33]
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [
                    GreenPowerProxy.cluster_id
                ],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.EXTENDED_COLOR_LIGHT,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    TuyaRGBCCTColorCluster,
                    LightLink.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Time.cluster_id,
                    Ota.cluster_id
                ],
            },
            242: {
                PROFILE_ID: 41440,
                DEVICE_TYPE: 97,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [
                    GreenPowerProxy.cluster_id
                ],
            },
        }
    }

Thanks, I eventually decided to try Zigbee2Mqtt which immediately solved all my issues. Even other cheap sensors I later bought that refused to work properly with ZHA, has no issues with Z2M. I now run two zigbee networks on different channels, ZHA for everything it supports, and Z2M for all the weird ones out there. This combo works like a charm, but require two Zigbee sticks.

FYI, unsupported Zigbee devices (e.g. missing entities/attributes in the ZHA integration) will need a “quirk” (ZHA Device Handler) so submit a new device support request as an issue to the ZHA Device Handlers repository on GitHub if someone has not already done so (search on the device signature ID before posting a new device support request), read and follow → https://www.home-assistant.io/integrations/zha#how-to-add-support-for-new-and-unsupported-devices

Tip; regardless if using ZHA or Z2M you need to be aware that Zigbee is extremely sensitive to EMF/EMI/RMI interference (especially the Zigbee Coordinator adapter since usually close to other electronics) and all Zigbee radios/devices have very short range and poor coverage, so before you troubleshoot any deeper you really need to start with taking active actions to follow the best peaches, read and try to follow all the tips here → Guide for Zigbee interference avoidance and network range/coverage optimization

Before troubleshooting deeper, connect your Zigbee Coordinator using a longer USB extension to a USB 2.0 port (not USB 3.0) and also add more/better Zigbee Router devices to your Zigbee network to extend range and coverage.