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):
- added to configuration.yaml:
zha:
database_path: /config/zigbee.db
enable_quirks: true
custom_quirks_path: /config/zha_quirks/
- added a folder āzha_quirksā to āconfigā
- downloaded the .py-file from here and put that in the new folder
- deleted the device from ZHA
- restarted HA
- put the device in discovery mode
- added a new device in ZHA
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"
],
Suggest post your details to that issue ā https://github.com/zigpy/zha-device-handlers/issues/1599
Thanks! I hadnāt seen that thread and found the improved quirk further down the conversation. I updated the quirk on my system and now it works like a charm!
For reference, the working quirk can be found in this post ā _TZE200_3towulqd TS0601 Tuya Motion Sensor with illuminance sensor Ā· Issue #1599 Ā· zigpy/zha-device-handlers Ā· GitHub
How do you manage to solve the problem ?
I think also that it used the quirk from the library and not the custom one.
I used the last py file posted in the the issue _TZE200_3towulqd TS0601 Tuya Motion Sensor with illuminance sensor Ā· Issue #1599 Ā· zigpy/zha-device-handlers Ā· GitHub
Thank you for your help
Iām also interested in solving his issue as I am bumping into the same.
Following the instructions did not work. I am not seeing the new quirk name showing under the device, despite re-pairing, restarting, etc.
Post new issue to ZHA Device Handlers for your device signature ID if there is not already one ā https://www.home-assistant.io/integrations/zha#how-to-add-support-for-new-and-unsupported-devices
Iām silly. The quirk I was using was not for my device
New comment
Can anybody help?
FYI, posted an updated version the the community guide section here ā Zigbee Guide: How-to setup local custom device handler quirks in ZHA integration
HI,
sorry for it but I0m tring for the first time to add a quirk in my HA os but when I chek the configuraiton I get the following error:
āInvalid config for āzhaā at configuration.yaml, line 18: not a directory for dictionary value āzha->custom_quirks_pathā, got āconfig/zha_quirks/āā
What I havent foudn a folder Custom therfore I created a new folder under the directory Homeassistant. I put the PY file there and then in configuration. yaml I inserted your code. but then I get the error. I customized youāre code replacing the folder config whit the folder name Homeassistant but nothing.
Iām sure is a stupid thing but would be great a little support
There is a step-by-step guide here that is probably a little easier to follow:
Also see here for an shorter/simpler less-detailed summerized guide:
Thank yoo for your answer!
Probably Iām making a mystake with the folder. I need to teel you that I0m not a programmer soā¦
Becouse Iām utilizing Home assistant OS just wiorking with File editor in HA I0m not sure if Iām utilizing the right folder.
In file editor Iām always in the folder HomeAssistant. There I created the new folder for the Quirks.
Therfore I tought to utiize the following code:
Preformatted text
database_path: /HomeAssistant/zigbee.db >> #I have Zigbee.db file in the Home assistant folder
enable_quirks: true
custom_quirks_path: /HomeAssistant/zha_quirks/ #where ZHA_quirks is the name of new folder where put the Quirk`
Iām operating right?
Thank you so much!