Zigbee Guide: How-to add/setup local custom ZHA Device Handlers (also known as ”quirks”) in the ZHA integration

If you add a new Zigbee device to Home Assistant and it does not show all expected feature/function entities (attributes) in the UI for the ZHA integration (the native "Zigbee Home Automation" gateway component that is built-in to Home Assistant), even after you tried multiple times to re-pair/re-join that same Zigbee device to the ZHA integration, then there is a big chance that your new Zigbee device will either need a new custom ZHA Device Handler (also known as a “zha-quirk”) for that specific device model or someone needs to modify an existing ZHA Device Handlers (also known as a “zha-quirks”) to extend it so that it will convert/translate all attributes into standard ZCL (Zigbee Cluster Library) formatting and/or expose all entity (attribute) that are now not yet showing by default in the current version on the ZHA integration.

ZHA Device Handlers (quirks) bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices. If the device is similar enough to a previous model that already has a device handler (quirk) for ZHA then most of the time all that will be needed is to add the device signature (model) of a new device to an existing ZHA Device Handler (quirk) if it basically the same device with different model number.

Note that if you submit a device request you then need to be patient before a new device handler (quirk) becomes includes in ZHA by default, as even someone else has already written or modified such a custom ZHA Device Handler (zha-quirk) to expose the missing entity/entities it can sometimes still take quite a long time before that specific "quirk" is merged into the mainline ZHA Device Handlers (“zha-quirks”) repository and for it to get added to Home Assistant's core for automatic inclusion in Home Assistant releases so it is seen by default, therefore until then you will need to manually add the ZHA Device Handler (zha-quirk) yourself to your own instance of Home Assistant.

How to add a ZHA Device Handler (zha-quirk) is not documented in the ZHA integration documentation, which is sad because if you as an end-user is an early-adopter that keep buying the latest brand new Zigbee devices as soon as manufacturers make them available then it is a huge chance are that you sooner or later will probably need to use a manually install a custom ZHA Device Handler (zha quirk), because new experimental ZHA Device Handlers (zha-quirks) will only be added after you have submitted a new device request properly -> https://www.home-assistant.io/integrations/zha#how-to-add-support-for-new-and-unsupported-devices (and even then you have to wait until someone in the community steps-up to code that quirk and submit it for merger).

Anyway, below is a summary of what you need to do to install a custom quirk after you download it:

How end-users can test a not yet merged custom quirk in ZHA

If you have bought a non-standard Zigbee device that is not yet supported by ZHA but someone have written a ZHA "quirk" module (ZHA Device Handler/Zigbee Converter) that not get been merged into a "ZHA Device Handlers"" library release then you can add that manually as a custom ZHA quirk to your Home Assistant instance, (using something like File Editor or Samba share add-ons in Home Assistant).

  1. Get a copy of an existing "custom quirk" that is meant for your specific device (or code your own custom quirks). Tip is to search for the specific Zigbee device signature among open issues and open pull requests as those might contain experimental custom quirk that have not yet been merged for your Zigbee device, see Issues · zigpy/zha-device-handlers · GitHub and Pull requests · zigpy/zha-device-handlers · GitHub
  2. Inside your Home Assistant instance, create a directory/folder for your custom quirks (for example /config/zha_quirks/)
  3. Copy or create a quirk file in this directory (called it for example “devicemodelzyz_devicetypexyz.py”). This file should contain the Python script for the quirk and its specific Zigbee device signature unique to it.
  4. Add configuration with the full path to the directory that now containing custom quirk module(s) that will override and take precedence over any built-in quirks matching any device that has the same Zigbee device signature. to Home Assistant's config.yaml
    zha:
       database_path: /config/zigbee.db
       enable_quirks: true
       custom_quirks_path: /config/zha_quirks/
    
  5. Use Home Assistant configuration check to make sure the config will not break your configuration.
  6. Restart Home Assistant to make the quirk take effect.

Note! If your Home Assistant is running inside a container then you must then you must edit and add the file inside that container, see Editing (ZHA) quirks in a (HA) container or local. · zigpy/zha-device-handlers · Discussion #693 · GitHub

Back-stopy, I initially wrote a guide for how-to manually adding a custom quirk to the ZHA locally as a pull request for the ZHA integration docs but it was not accepted with the argument that it is too advanced for the ZHA integration so I and then resubmitted an update of it for the readme in ZHA Device Handlers (zha-quirks) repository on GitHub, but that has not yet been accepted/merged either -> Add a how-to guide for how end-users can use a custom quirk in ZHA by Hedda · Pull Request #2419 · zigpy/zha-device-handlers · GitHub

PS: This question have been asked hundreds of times in the community and previously discussed here:


Link to this and other helpful tips also found in the HA Cookbook:

29 Likes
The Home Assistant Cookbook - Index
How to setup local ZHA quirks
Configuring custom quirks
Tuya Temperature Sensors with Home Assistant
Zigbee network utilization - options
Home Assistant + Aqara + Tuya
Same Zigbee device, different recognition
Zigbee buyer's guide
Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>
IKEA Tretakt smart plug wrongly recognized
ZHA custom quirk to work with Tuya TS0601 _TZE204_dapwryy7 occupancy sensor
Display of device differs from values shown in HA for zibgee device
GiEX smart water valve with ZHA
Best way to configure WiFi Tuya sensors?
New zigbee coordinator, adjust configuration
What am I missing out on when I add aqara devices to my zigbee Network whithout using the aqara hub?
How to setup local ZHA quirks
Zigbee flowerpot and plant sensors for soil moisture + light + temperature + humidity (using Zigbee Gateway like the ZHA integration or Zigbee2MQTT)?
Zigbee flowerpot and plant sensors for soil moisture + light + temperature + humidity (using Zigbee Gateway like the ZHA integration or Zigbee2MQTT)?
Custom Quirk for Zemismart (Tuya) Switch using ZHA
_TZE204_ue3rzddr support
I want to start over, useful tips? Which hardware to support Zigbee2MQTT
SmartThings SmartSense Multi (2013) works on zigbee, but then hours later vanishes
Innr SP242 smart plug Sumation Delivered out by factor of 100
Zlinky shows only Sum of used Electricity
Zemismart Integration TS0601 TZE284
Nimly lock, with Zigbee module
Zigbee plug *without* power monitoring
HowTo Motion/Precence sensor TS0601 TZE204_no6qtgtl from TEMU
ZHA: Tilt on (Aqara) vibration sensor
Nimley Touch Pro via ZA
Aqara E1 Curtain Driver Battery Sensor in ZHA
Bosch Thermostat 2 missing entities in ZHA
New ZTH11 Zigbee thermometer does not show temp
Migrating from a Philips Hue Bridge to the ZHA (Zigbee Home Automation) integration
ECO-DIM.05 dual dimmer not supported in ZHA?
Philips Contact Sensor integration Zigbee ZHA
Bosch Thermostat 2
Tuya Siren TS0601 da _TZE284_nlrfgpny issues
Ecodim .07 ZigBee Dimmer Issue: Incorrect State Updates for On/Off Actions
Adding an effect to light bulb
Shelly Gen4 zigbee mode?
Home Assistant Cookbook - Discussion Thread
Home Assistant Cookbook - Discussion Thread
Home Assistant Cookbook - Discussion Thread
2025.7 Beta Week
Bosch / Twinguard: enable statistics for more entities (hum, pressure...)
ZHA recognizes device, but no entities
Frient joins Works with Home Assistant
How to Add YRL 216 to Home assistant
Frient joins Works with Home Assistant
Frient joins Works with Home Assistant
Help needed with Zigbee TRV TS0601 by _TZE204_vjpaih9f
IKEA just announced 21 new affordable Matter-over-Thread smart home devices (which may also support Zigbee too)
Aqara Remote Light Switch H1 2 Rocker
Sonoff TRVZB: Firmwareupdate 1404, but no adaptive mode in ZHA?
Sonoff TRVZB: Firmwareupdate 1404, but no adaptive mode in ZHA?
Identifying zigbee device
TS0601 from _TZE284_cwyqwqbf
TS0601 from _TZE284_cwyqwqbf
Support for Tuya Zigbee Thermostat (_TZE284_vhzi3fyv ) zigbee2mqtt
Sonoff SNZB‑01M Remote (ZHA) — 16‑Action Event-Based Control
TS0601 by_TZE284_8se38w3c not showing sensor data
HEIZHS2WD Siren
Support for Tuya Zigbee digital thermostat _TZE284_khah2lkr
Heiman joins Works with Home Assistant
Zigbee network optimization: a how-to guide for avoiding radio frequency interference + adding Zigbee Router devices (repeaters/extenders) to get a stable Zigbee network mesh with best possible range and coverage by fully utilizing Zigbee mesh networking
Tuya integration in home assistant
Unrecognized tuya soil sensor
1% Failure Rate - Help!
Connecting New Devices to ZHA with CC2652P
Bosch Thermostat 2 missing entities in ZHA
Newbee in IoT
Question: Overwrite MACCapabilityFlags
Big problems with Zigbee all of a sudden - Please help me debug
ZigBee device configuration help needed
Help required! Ideal Halo Boiler Control + Sonoff Zigbee 3.0 USB Dongle Plus
Wrong amperage in Home Assistant
ZHA integration UI to have web-link to submit device support requests to ZHA Device Handlers issues on GitHub if need quirk to expose additional attributes as entities?
Zigbee temperature sensor & switch only detected as "light"
Same Zigbee device, different recognition
Best devices for HA to start with
Zigbee Remote ZGRC-KEY-013 doesn't show possible actions in Home Assistant GUI
If you had to start from scratch would you go skyconnect or sonoff?
Custom ZHA Device Handlers (ZHA custom quirks handler implementation)
Smart Water Valve, Zigbee
ZHA fails, Zigbee2mqtt works
Hue Integration Fails - "This entity is not available"
ZHA fails, Zigbee2mqtt works
Wireless (Tuya based) Zigbee button not fully supported on HA
Nortek and mesh Zigbee
GIRIER Tuya ZigBee 3.0 Light Switch Module 2 gang not detecting properly in HA
Skyconnect: device paired successfully, next day lost, now does not connect-pair anymore
Migrating from a Philips Hue Bridge to the ZHA (Zigbee Home Automation) integration
A to Zig - a Zigbee glossary
Not many people know that... A random collection of Zigbee trivia
ZigBee TRV connection issues
Zigbee2mqtt + skyconnect, cant get it to work
How to setup local ZHA quirks
ZHA and devices not reliable issues
Smoke Sensor Heiman HS2SA-1 Zigbee
ZHA devices incorrectly configured, wrong quirk
ZHA custom quirk to work with Tuya TS0601 TZE204_laokfqwu occupancy sensor
ZHA Philips Hue Bulbs can only be switched on/off, but not dimmed
Zha disable device router for one device
Issues with HA Yellow & ZHA / Philips Hue after a long period - Help a noob
How to listen for button presses on Zigbee Remote control
What to do when a Zigbee device isn't understood by ZHA?
TS0601 by _TZE200_viy9ihs7 - no functions
Unable to turn on extensions for Aqara T1 led strip ZHA
ZHA Quirk of Zigbee Smoke detector TS0205
Question: Overwrite MACCapabilityFlags
ZHA custom quirk to work with Tuya TS0601 TZE204_laokfqwu occupancy sensor
Happy Holidays! Anyone considering the new Philips Hue Festavia String Tree Lights?
ZHA custom quirk to work with Tuya TS0601 TZE204_laokfqwu occupancy sensor
How to setup local ZHA quirks

Note! If there is not already a quirk (ZHA Device Handler) for your specific Zigbee device in the ZHA integration and/or there already is a quirk there but it is still not exposing all expected attributes as entities inside ZHA UI in Home Assistant you need to then begin by submitting a new device support request as an issue to the ZHA Device Handlers repository on GitHub,requesting a new custom quirk (ZHA Device Handler) in that new issue by filling out the template there with requested information to open a dialogue custom ZHA Device Handler developers with the ZHA quirks community -> https://www.home-assistant.io/integrations/zha/#how-to-add-support-for-new-and-unsupported-devices

FYI, by default the ZHA integration just creates entities in Home Assistant for features and functions that are standard in the official ZCL (Zigbee Cluster Library) specification, and therefor custom ZHA Device Handlers (zha-quirks) are generally only needed if the device firmware have some manufacturer specific functionality (e.g. features and functions) that is not standard in the ZCL specification, or if the device firmware has implemented ZCL specification incorrectly (i.e. poorly written firmware or a bug in the firmware). So by definition all Zigbee devices that do not use manufacturer specific functionality should be compatible with the ZHA integration out-of-the-box without changes, and if they do have manufacturer specific functionality then the ZHA integration should only need a device handler to expose those specific quirks that are unique to that device or manufacturer.

HOW TO ADD SUPPORT FOR NEW AND UNSUPPORTED DEVICES

If your Zigbee device pairs/joins successfully with the ZHA integration but does not show all of the expected entities

  1. Try to re-pair/re-join the device several times.
  2. Checkout the troubleshooting section.
  3. Still not working? You may need a custom device handler. This handler will have exception handling code to work around device-specific issues.

For devices that do not follow the standard defined in the CSA’s ZCL (Zigbee Cluster Library), the ZHA integration relies on a project called “ZHA Device Handlers (also known as “zha-quirk”)”. It contains device-specific Python scripts called “quirks”. These scripts can resolve compliance and interoperability issues by implementing on-the-fly conversion of custom Zigbee configurations or by implementing manufacturer-specific features for specific devices.

People familiar with other Zigbee gateway solutions for home automation may know similar concepts of using custom Zigbee device handlers/converters for non-standard devices. For example, Zigbee2MQTT (and IoBroker) uses zigbee-herdsman converters and SmartThings Classics (Legacy) platform has Hub Connected Device Handlers.

If you do not want to develop such a “quirk” Python script yourself, you can submit a “device support request” as a new issue to the ZHA Device Handlers project repository on GitHub.

What the heck is a quirk

In human terms you can think of a quirk like Google Translate. I know it's a weird comparison but let's dig in a bit. You may only speak one language but there is an interesting article written in another language that you really want to read. Google Translate takes the original article and displays it in a format (language) that you understand. A quirk is a file that translates device functionality from the format that the manufacturer chose to implement it in to a format that Zigpy and in turn ZHA understand. The main purpose of a quirk is to serve as a translator. A quirk comprises several parts:

  • Signature - To identify and apply the correct quirk
  • Replacement - To allow Zigpy and ZHA to correctly work with the device
  • device_automation_triggers - To let the Home Assistant Device Automation engine and users interact with the device

Note! Best to first search existing issues with device signature and track open device support requests:

Note that submitting a new “device support request” does not guarantee that someone else will develop a custom “quirk” for ZHA. The project relies on volunteering developers. However, without “device support requests”, the developers may not be aware that your specific Zigbee device is not working correctly in ZHA.

PS: Fow information on how-to actually code/write your own Zigbee Device Hanler quirks see this related development discussion meant for quirk developers here:

1 Like

FYI, @Regenbui also wrote a very detailed instruction on adding a custom quirk in this other thread → How to configure the Philips Hue wall module to use push button (momentary) type wall switches [ZHA] - #27 by Regenbui

1 Like

@carlosjusto The thing is that there already are several ZHA Device Handlers (quirks) for many different Tuya switches, so often you just need to add device signature (model) to an existing ZHA Device Handler (quirk), which is something that practically anyone here should be able to do without any coding skills.

That is, if you have a new Tuya device that is similar to existing devices but just uses a (new) different device signature models number (which is very common) then you usually just need to add any new device signature model to the existing ZHA Device Handler (quirk) under the correct device class, which is not something that is relativly easy and do not require coding skills so you can try doing it yourself.

Root cause to thiis the problem is that Tuya not only deviates from Zigbee specifications/standards but more confusingly to end-users uses no logic in their model schema used in their device signatures ( so the ZHA developers can not deduce what similar devices there based on Tuya’s device signature model numbers alone (and that for it is not possible to use wildcards to use a specific ZHA Device Handler quirk for new device signature models that were previously unknown ) + fact is that Tuya is a company that manufactures the same while-label product variants to tens or hundreds of other companies and therefore use different device signature models for what is essentially the same product hardware and same or very similar firmware, with often only the model variant in device signature being different.

The good thing about that is that it makes it relatively easy for you or anyone else to simply test adding additional device signature models to an existing Tuya ZHA Device Handler quirk with the same capability.

Best however is if you open first open a new device request issue regardless so that the specific model can be tracked and you can get help from others in the community → https://github.com/zigpy/zha-device-handlers/issues/new/choose

So what you can do is open each of the existing Tuya “switch” quirks (for OnOff switches) and see if can find a similar one,

Try for example adding that model to this “ts0601_switch.py” ZHA Device Handlers (quirk) code file:

From reading just the non-code text is that file it should be obvious that you for example would want to test adding the device signature model a new 4-gang switch under either the “class TuyaQuadrupleSwitchTO(TuyaSwitch” (section that contain “”“Tuya quadruple channel switch time on out cluster device.”““as description) or theclass TuyaQuadrupleSwitch_GP(TuyaSwitch):(section that contain””“Tuya quadruple channel switch with GreenPowerProxy cluster device.”“”`) depending if your product feature the GreenPowerProxy cluster or not, (you should see that if export diagnostic information as it mentions “PROXY_BASIC” as device_type and a “green_power” attribute. See

and

Today those only have these models but as you probably understand now you can test adding more.

    signature = {
        MODELS_INFO: [
            ("_TZE200_aqnazj70", "TS0601"),
            ("_TZE200_1ozguk6x", "TS0601"),
            ("_TZE200_k6jhsr0q", "TS0601"),
        ],

and

    signature = {
        MODELS_INFO: [
            ("_TZE200_1n2kyphz", "TS0601"),
            ("_TZE200_mexisfik", "TS0601"),  # reported #1634
        ],

The same procesure then goes for your 6-gang (sextuple) switch, see:

and

Those today only list the device signature models for these:

        MODELS_INFO: [
            ("_TZE200_9mahtqtg", "TS0601"),
            ("_TZE200_wnp4d4va", "TS0601"),
        ],

and

    signature = {
        MODELS_INFO: [
            ("_TZE200_9mahtqtg", "TS0601"),
            ("_TZE200_emxxanvi", "TS0601"),
        ],

… and so on …

1 Like

Tip if you have Tuya device is to check out this other Tuya specific guide:

@Hedda, this may be a completely different topic, but is there a way to manually apply a quirk to a Zigbee group?

In my case I have a lot of Inovelli 2-1 dimmers and I’d like to set some of their parameters as a Zigbee group action instead of having ZHA send commands to all the dimmers individually. Specifically I’m trying to set the “Local default dimming level” to the brightness level of adaptive lighting, so when a light is turned on it immediately goes to the correct brightness with no too-bright momentary flash or delay because it starts too dim.

Is this doable with ZHA? If not it seems like it could be a very useful feature.

Not quite sure what you mean but it is not possible to apply a quirk to a ”Zigbee group” (which might not be what you mean), regardless, yes your question asked that way is completely different topic, ”Zigbee groups” has nothing to do with using or creating ZHA Device Handlers (quirks), so please post a new separate thread instead.

I'm a bit lost. I've got a device that appears to be a TS1201 IR blaster, which is already merged into the ZHA device handlers repo. Should it not be accessible in home assistant - why am I copy-pasting the file myself?

If a quirk for exact same Zigbee ID (unique device model ID that it exposes via its firmware) has already been merged into the ZHA device handlers repo and is now part of the zha-quirks release updated to be used by Home Assistant's core then you should not have to copy any files yourself, HOWEVER, Tuya being Tuya they are infamously know for now following any standards or logic and usually release several products of the same type of device and name with slightly different variants of Zigbee IDs (device model IDs used in the firmware).

So the fact is that the ZHA device handlers repo actually already have quirks for no less than eight (8!!!) different sub-variants of Tuya "TS1201" IR blaster device models with each having different Zigbee ID, so it could be that your device is another new variant with yet another new Zigbee ID that then needs be added to the ZHA device handlers repo as well. See:

        MODELS_INFO: [
            ("_TZ3290_7v1k4vufotpowp9z", "TS1201"),
            ("_TZ3290_acv1iuslxi3shaaj", "TS1201"),
            ("_TZ3290_gnl5a6a5xvql7c2a", "TS1201"),
            ("_TZ3290_rlkmy85q4pzoxobl", "TS1201"),
            ("_TZ3290_nba3knpsarkawgnt", "TS1201"),
        ],
        MODELS_INFO: [
            ("_TZ3290_ot6ewjvmejq5ekhl", "TS1201"),
            ("_TZ3290_j37rooaxrcdcqo5n", "TS1201"),
            ("_TZ3290_u9xac5rv", "TS1201"),
        ],

And worse, there are even existing open device support requests in the ZHA device handlers repo for additional new variants of sub-variants of Tuya "TS1201" IR blaster device models, so you just have to search there and add your subvariant as another new device support requests in the ZHA device handlers repo if there is not already and existing open issue for your specific model.

If you are interested becoming a quirk developer and learning more about Tuya then read these:

You could also use more powerful LLM models in Copilot or Claude Code with this help of this:

Thanks for the info!

I managed to more-or-less figure out the "signatures" part since posting that original comment. I just added mine to the quirk on git and it got picked up :slight_smile: A bit fiddly IMO but not something I'd have to deal with in 99% of scenarios!

1 Like

Again, if you have any Zigbee product that pairs with ZHA (i.e. joins the Zigbee network) and goes through device-interview but then do not expose all expected attributes as entities inside ZHA in Home Assistent then always submit an new "device support request" issue to zha-device-handlers if there is not already an issue started for it there (or if there already is one then help contribute info to it instead).

In summery, this thread in the community forums is the wrong place to report problems with devices device support requests for ZHA, instead always request missing device features via issues in the zha-device-handlers repository on GitHub. That will help ZHA-quirk developers be made aware of that specific device having problems and other users can find + track devices known to be missing entities via issues there as a peristant knowledgebase. Pleaee see here:

Note that even if you feel that this is a bug and not a feature request then you should still submit it to the zha-device-handlers repo on GitHub so that there is a record of it that can be tracked and others can find for reference, and that will benefit everyone in the community in the long run.

Like you said, all that is also bit fiddly but not something you have to deal with in 99% of scenarios, and you have to deal with it even less than so if you do not buy devices made by Tuya! :winking_face_with_tongue:

1 Like