ZHA fails after update 2023.3.x

When I updated to Core 2023.3.1 a week ago my ZHA system was not functioning at all so I rolled back as I had no time to deal with it then.

Tonight I updated to 2023.3.2 and ZHA was dead again, the logs have these error messages:

Logger: homeassistant.config_entries
Source: custom_zha_quirks/ts0601_pirmotion.py:22
First occurred: 6:30:02 PM (1 occurrences)
Last logged: 6:30:02 PM

Error setting up entry Sonoff Zigbee 3.0 USB Dong - /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_dac32ed7f4d8eb1194fc0a15b9da5f8b-if00-port0, s/n: dac32ed7f4d8eb1194fc0a15b9da5f8b - ITead - 10C4:EA60 for zha
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/zha/__init__.py", line 110, in async_setup_entry
    setup_quirks(config)
  File "/usr/local/lib/python3.10/site-packages/zhaquirks/__init__.py", line 409, in setup
    importer.find_module(modname).load_module(modname)
  File "<frozen importlib._bootstrap_external>", line 548, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1063, in load_module
  File "<frozen importlib._bootstrap_external>", line 888, in load_module
  File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 719, in _load
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_zha_quirks/ts0601_pirmotion.py", line 22, in <module>
    from zhaquirks.tuya.mcu import (
ImportError: cannot import name 'TuyaDPType' from 'zhaquirks.tuya.mcu' (/usr/local/lib/python3.10/site-packages/zhaquirks/tuya/mcu/__init__.py)
Logger: homeassistant.components.automation
Source: components/automation/config.py:207
Integration: Automation (documentation, issues)
First occurred: 6:29:28 PM (1 occurrences)
Last logged: 6:29:28 PM

Blueprint 'ZHA - IKEA TRADFRI - 5 Button Remote - Custom Actions' generated invalid automation with inputs OrderedDict([('remote', 'aaf7d4b9d3b7fff040db49edb780dae7'), ('power_short', [OrderedDict([('service', 'switch.toggle'), ('data', OrderedDict()), ('target', OrderedDict([('entity_id', 'switch.sonoff_1000f5fb21_1')]))]), OrderedDict([('service', ''), ('data', OrderedDict())])])]): Service does not match format <domain>.<name> for dictionary value @ data['action'][0]['choose'][0]['sequence'][1]['service']. Got ''

I removed those quirks and now ZHA is working and the 2 devices seem to be working OK without the quirks.

Can someone explain what the issue is.

Complete guess - ZHA changed the format of quirks files or reverting versions meant the files on disk weren’t compatible with the updated ZHA code, and as ZHA didn’t start cleanly, the cached quirks could not be updated.

Certainly, the IKEA TRÅDFRI 5-button Zigbee remote quirk had some major changes with 2023.3 after a new IKEA firmware was released:

If you want more, look in GitHub

Oh, and…

If this helps, :heart: this post!