Unexpected exception importing custom quirk 'tuya_siren' (ImportError: cannot import name 'BatterySize' from 'zhaquirks.const')

Hello everyone,

A few weeks ago I opened an issue to the zha devs as I bought a Tuya Siren for which no entities or sensors appeared. The issue was implemented as you can see in the link below:

Tuya Siren (new) TS0601 by _TZE284_nlrfgpny · Issue #3667 · zigpy/zha-device-handlers

It appears now in the zha handlers repository ( _TZE284_nlrfgpny):

zha-device-handlers/zhaquirks/tuya/tuya_siren.py at dev · zigpy/zha-device-handlers

However, I already modified my configuration.yml file to enable custom quirks (in fact one custom quirk for a thermostat works fine):

Enable custom quirks

zha:
enable_quirks: true
custom_quirks_path: /config/custom_components/zha_quirks

The problem is that when I reboot HA I see the following error message:

`Unexpected exception importing custom quirk ‘tuya_siren’

Traceback (most recent call last):
File “/usr/local/lib/python3.13/site-packages/zhaquirks/init.py”, line 479, in setup
spec.loader.exec_module(module)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File “”, line 1026, in exec_module
File “”, line 488, in _call_with_frames_removed
File “/config/custom_components/zha_quirks/tuya_siren.py”, line 7, in
from zhaquirks.const import BatterySize
ImportError: cannot import name ‘BatterySize’ from ‘zhaquirks.const’ (/usr/local/lib/python3.13/site-packages/zhaquirks/const.py)`

I saw that in the zha repository there’s a const.py file with the BatterySize enum but I don’t know where I have to put it as in my HA filesystem there is no such path (/usr/local/lib/python3.13/site-packages/zhaquirks).

If I pair the device I cannot see entities or sensors (as before the implementation of the custom quirk) so I guess that error is not allowing me to use it properly. Any hint?

My HA version is the latest one:

  • Core: 2025.1.4
  • Supervisor: 2024.12.3
  • Operating System: 14.1
  • Frontend: 20250109.2

Thanks!

You’d have to pull in a ton of changes to make this work. The easiest option would be to wait for HA 2025.2.

1 Like

Hi,
I updated this week to 2025.2 but still, when I pair it, just see 2 entities (LQI/RSSI). Am I doing something wrong or the changes for this device were not included in 2025.2?

Thanks!

Looks like I read too fast and missed that you had a _TZE284_nlrfgpny, I added _TZE200_nlrfgpny, just add another applies_to until we can get a PR in.

1 Like

Hi, when do you plan to PR the change? I just checked on 2025.3.1 but still the same.

Thanks!