1. Create a custom quirk dir in HA, e.g., /config/custom_zha_quir
is it mean to " make Dir in Rapberry pi"
my System is Raspberry pi 4 + zigbee Dongle E
1. Create a custom quirk dir in HA, e.g., /config/custom_zha_quir
is it mean to " make Dir in Rapberry pi"
my System is Raspberry pi 4 + zigbee Dongle E
UPDATE #1 See this community guide thread here → Zigbee Guide: How-to setup local custom device handler quirks in ZHA integration
UPDATE #2 Now also submitted a pull request for ZHA Device Handlers (zha-quirks) readme file → 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
FYI, I wrote a guide for adding a custom quirk to ZHA as a pull request for the ZHA integration docs but it was not accepted → https://github.com/home-assistant/home-assistant.io/pull/23884
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).
/config/zha_quirks/
)devicemodelzyz_devicetypexyz.py
”). This file should contain the Python script for the quirk and its specific Zigbee device signature unique to it.zha:
database_path: /config/zigbee.db
enable_quirks: true
custom_quirks_path: /config/zha_quirks/
thanks for the explanation. I’ve done this for the “”“Samjin Multi 2019 Refresh Quirk.”"" because I wanted the tilt data (accelerometer x, y and z) which was availabe when I used Deconz / Phascon prior to switch to ZHA.
I added the quirk after pairing the device, and after restarting HA, I still don’t see the accelerometer sensor. Do I need to remove, and repair the device?
Yes, you have to remove and add the device again in order to install it using the info from your Quirk.
hmm ok I have removed and re added, but still no accelerometer sensors.
Maybe I installed the quirk incorrectly? I put the python files from this github into a sub-folder “config/custom_zha_quirks”
and then added that folder to my config.yaml
Try this:
zha:
enable_quirks: true
custom_quirks_path: /config/custom_zha_quirks
thanks for trying, and for the link, but still no luck. I’m not sure what to try now.
Is this what you have tried? Are you sure you have appropriated quirks for your devices?
yes that’s exactly what I did. And I’m sure I have the appropriate quirk. Should the python files be in their own sub-direcory like it was when I downloaded the quirks zip file? I just moved them into the /custom_zha_quirks as per your advice.
In fact, if I look at the “Device info” panel for the device, it looks like its using the quirk. And when I click on the three dots menu, and choose “SmartThingsAccelCluster” I can read the x,y,z acceleration data in the zigbee message, its just not exposed as a sensor entity in home assistant.
Why are you expecting those values in entities and not as part of the event? Have you seen any instalation of this device & quirk where those values are assigned to individual entities?
By the way, don’t you have that info as attributes of your vibration sensor entity? I’m not saying I’m expecting this, just curious.
By the way, I have an Aqara vibration sensor connected thru ZHA and I don’t have any entity with X, Y and Z values.
Sorry I’m new to ZHA. I used to use the Deconz zigbee hub, and with the same multi-sensor device, there was a sensor entity that with a template, I could extrac the x, y, and z acceleration values. I’m not sure what you mean by getting the “values as part of the event”. Which event?
I don’t think there is a vibration sesnor entity. The “Workshop door” and “Accelerometer” are both binary sensors.
The binary-sensor called “Accelerometer” was the one I was referring to. Don’t you have attributes under that sensor?
no, it’s binary
When a Zigbee device (and many other integrations) send a message to Home Assistant informing it changed, that is an event. Here you can find more on what events are.
For your automations, you can have a trigger based on a event for this specific device, as described here.
And you can use the trigger’s variables to get information about those values on your event, as described here
You can go to Developer tools > Events and then start listening for zha_event
, then move your sensor and you will have an event like this (this is a screens hot from my Aqara sensor’s event):
In this case, I probably will get the “X” coordinates under trigger.event.data.args.X
or trigger.event.data.args.Y
, etc…
Why don’t you share what you are trying to achieve with those values (X, Y and Z) or perhaps share your existing automation developed for DeCONZ so the community can try to help you more?
Binary sensors can also have attributes.
Take a look for this binary sensor (and perhaps any other entity within this device) under Developer tools > State and take a look for attributes. Maybe you have this info (X, Y, Z) there.
thankyou so much, this is what I needed!
I already tried this, but did not see the x, y, z values. In any case, I just tried listening to zha_event, and can see the X, Y, Z data. Now I can write an automation based on it thanks to your links above!
Hi,
For anyone that’s following this thread. I had to add the database path to in order to actually load the quirks. I added:
zha:
database_path: /config/zigbee.db
enable_quirks: true
custom_quirks_path: /config/zhaquirks
Update: submitted new how-to guide for adding custom quirks to ZHA to the ZHA Device Handlers repo:
Hi,
I’ve been trying to add a custom quirk for the TuYa Pir Motion and Illuminance sensors I bought, because ZHA recognizes some of the sensors as a smoke alarm and after initializing doesn’t receive any update from the sensor: it just states “clear”.
So I followed the steps as described above and in some other topics (thanks @Hedda for the detailed description):
zha:
database_path: /config/zigbee.db
enable_quirks: true
custom_quirks_path: /config/zha_quirks/
The device was then initialized and added. But it still doesn’t work. If I download diagnostics, it states halfway:
"data": {
"ieee": "**REDACTED**",
"nwk": 19146,
"manufacturer": "_TZE200_3towulqd",
"model": "TS0601",
"name": "_TZE200_3towulqd TS0601",
"quirk_applied": false,
"quirk_class": "zigpy.device.Device",
"manufacturer_code": 4417,
"power_source": "Battery or Unknown",
"lqi": 248,
"rssi": -38,
"last_seen": "2023-04-23T21:05:05",
"available": true,
"device_type": "EndDevice",
It seems like ZHA doesn’t recognises it should use the installed quirk. The manufacturer and model are the same as described in the quirk:
class PirMotion(CustomDevice):
"""Tuya PIR motion sensor."""
signature = {
MODELS_INFO: [("_TZE200_3towulqd", "TS0601")],
ENDPOINTS: {
# endpoints=1 profile=260 device_type=0x0402
# in_clusters=[0x0000, 0x0001, 0x0500],
# out_clusters=[0x000a, 0x0019]
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
INPUT_CLUSTERS: [
Basic.cluster_id,
TuyaPowerConfigurationCluster.cluster_id,
IasZone.cluster_id,
],
OUTPUT_CLUSTERS: [
Time.cluster_id,
Ota.cluster_id,
],
}
},
}
My question: am I overlooking something here?
I’ll copy the start of the diagnostics file also in, so my installation details are also provided:
{
"home_assistant": {
"installation_type": "Home Assistant OS",
"version": "2023.4.6",
"dev": false,
"hassio": true,
"virtualenv": false,
"python_version": "3.10.10",
"docker": true,
"arch": "aarch64",
"timezone": "Europe/Amsterdam",
"os_name": "Linux",
"os_version": "5.15.84-v8",
"supervisor": "2023.04.0",
"host_os": "Home Assistant OS 9.5",
"docker_version": "20.10.22",
"chassis": "embedded",
"run_as_root": true
},
...some custom components mentioned here...
"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.1",
"pyserial==3.5",
"pyserial-asyncio==0.6",
"zha-quirks==0.0.97",
"zigpy-deconz==0.20.0",
"zigpy==0.54.1",
"zigpy-xbee==0.17.0",
"zigpy-zigate==0.10.3",
"zigpy-znp==0.10.0"
],