Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HA 2024.9.0] Error: module 'zigpy.zcl.foundation' has no attribute 'DATA_TYPES' #261

Open
Nerwyn opened this issue Sep 4, 2024 · 20 comments

Comments

@Nerwyn
Copy link

Nerwyn commented Sep 4, 2024

As of Home Assistant Core 2024.9.0, the following error is thrown for the following action:

data:
  ieee: sensor.bedroom_vindstyrka_pm2_5
  endpoint: 1
  manf: 4476
  cluster: 64638
  attribute: 0
  state_id: sensor.bedroom_vindstyrka_tvoc
  allow_create: true
action: zha_toolkit.attr_read
Exception 'module 'zigpy.zcl.foundation' has no attribute 'DATA_TYPES'' for service call with data '{'zha_toolkit_version': 'v1.1.19', 'zigpy_version': '0.66.0', 'zigpy_rf_version': '0.40.5', 'ieee_org': 'sensor.bedroom_vindstyrka_pm2_5', 'ieee': '30:fb:10:ff:fe:20:7c:47', 'command': 'attr_read', 'command_data': None, 'start_time': '2024-09-04T20:25:00.223965+00:00', 'errors': ['AttributeError("module \'zigpy.zcl.foundation\' has no attribute \'DATA_TYPES\'")'], 'params': {'endpoint_id': 1, 'cluster_id': 64638, 'attr_id': 0, 'dir': 0, 'manf': 4476, 'tries': 1, 'expect_reply': True, 'args': [], 'state_id': 'sensor.bedroom_vindstyrka_tvoc', 'allow_create': True, 'read_before_write': True, 'read_after_write': True}, 'success': False}'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 828, in toolkit_service
    raise handler_exception
  File "/config/custom_components/zha_toolkit/__init__.py", line 784, in toolkit_service
    handler_result = await handler(
                     ^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 894, in command_handler_default
    return await default.default(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/default.py", line 51, in default
    await handler(app, listener, ieee, cmd, data, service, params, event_data)
  File "/config/custom_components/zha_toolkit/zcl_attr.py", line 311, in attr_read
    await attr_write(*args, **kwargs)
  File "/config/custom_components/zha_toolkit/zcl_attr.py", line 385, in attr_write
    found_attr_type = f.DATA_TYPES.pytype_to_datatype_id(
                      ^^^^^^^^^^^^
AttributeError: module 'zigpy.zcl.foundation' has no attribute 'DATA_TYPES'
@x86fr
Copy link

x86fr commented Sep 4, 2024

Same issue here :

Update Linky data: Error executing script. Unexpected error for call_service at pos 1: module 'zigpy.zcl.foundation' has no attribute 'DATA_TYPES'

Exception 'module 'zigpy.zcl.foundation' has no attribute 'DATA_TYPES'' for service call with data '{'zha_toolkit_version': 'v1.1.19', 'zigpy_version': '0.66.0', 'zigpy_rf_version': '0.40.5', 'ieee_org': 00:15:8d:00:05:d2:9d:c3, 'ieee': '00:15:8d:00:05:d2:9d:c3', 'command': 'attr_read', 'command_data': None, 'start_time': '2024-09-04T23:13:00.154898+00:00', 'errors': ['AttributeError("module \'zigpy.zcl.foundation\' has no attribute \'DATA_TYPES\'")'], 'params': {'endpoint_id': 1, 'cluster_id': 2820, 'attr_id': 774, 'dir': 0, 'tries': 1, 'expect_reply': True, 'args': [], 'state_id': 'sensor.linky_apparent_power', 'allow_create': True, 'read_before_write': True, 'read_after_write': True}, 'success': False}'

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 755, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1795, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 463, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 828, in toolkit_service
    raise handler_exception
  File "/config/custom_components/zha_toolkit/__init__.py", line 784, in toolkit_service
    handler_result = await handler(
                     ^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 894, in command_handler_default
    return await default.default(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/default.py", line 51, in default
    await handler(app, listener, ieee, cmd, data, service, params, event_data)
  File "/config/custom_components/zha_toolkit/zcl_attr.py", line 311, in attr_read
    await attr_write(*args, **kwargs)
  File "/config/custom_components/zha_toolkit/zcl_attr.py", line 385, in attr_write
    found_attr_type = f.DATA_TYPES.pytype_to_datatype_id(
                      ^^^^^^^^^^^^
AttributeError: module 'zigpy.zcl.foundation' has no attribute 'DATA_TYPES'

@x86fr
Copy link

x86fr commented Sep 4, 2024

Here is the commit in Zigpy that broke ZHA Toolkit: zigpy/zigpy@8db3735

Not very complex to fix (f.DATA_TYPES.pytype_to_datatype_id() => f.DataType.from_python_type() should do the trick - UNTESTED), but there is potentially a big number of users impacted.

@samuel9554
Copy link

+1. Same issue here

@Smandurlo
Copy link

+1

@mfwalsh
Copy link

mfwalsh commented Sep 5, 2024

+1 - Same Problem

@x86fr
Copy link

x86fr commented Sep 5, 2024

Not that trivial finally. The way they converted DATA_TYPES to DataType requires a lot of changes in ZHA Toolkit to match the new structure of the class. 😒

@x86fr
Copy link

x86fr commented Sep 5, 2024

Temp fix : downgrading to 2024.8.3 (zigpy < 0.66) solve the issue.

ha core update --version 2024.8.3

@jjrytko
Copy link

jjrytko commented Sep 5, 2024

I was able to fix most errors by replacing f.DATA_TYPES.pytype_to_datatype_id() with f.DataType.from_python_type().type_id

However I can see references to DATA_TYPES in scan_device.py and utils.py so more fixes are most likely needed.

@raspberryvincent
Copy link

Hello, does anyone know if there will be anything new in a next update? Just to know if i retrograde or if I wait a little. Thanks :)

@CordoWEB
Copy link

CordoWEB commented Sep 11, 2024

Hello, does anyone know if there will be anything new in a next update? Just to know if i retrograde or if I wait a little. Thanks :)

If you do not need Home Assistant new features, do not upgrade ! At each update there are news bugs with Zhatoolkit !
I'm using HA 2024.6.4 and all works perfect with this version.

@trondtorsoe
Copy link

trondtorsoe commented Sep 13, 2024

What I find strange..... is that it is working (for me) with 9-BETA......
beta
and NOT with 9.0

@nikscha
Copy link

nikscha commented Sep 15, 2024

same issue

@jetmcquack
Copy link

+1

@Sraoune
Copy link

Sraoune commented Sep 16, 2024

Same issue here

@maikvitesse
Copy link

+1

1 similar comment
@Nukle0n
Copy link

Nukle0n commented Sep 18, 2024

+1

@Hedda
Copy link
Contributor

Hedda commented Sep 18, 2024

What I find strange..... is that it is working (for me) with 9-BETA......
and NOT with 9.0

Home Assistant 9.0 -BETA was probably before ZHA was bumpled to 0.0.32 which in turn uses 0.66.0

home-assistant/core#124804

https://github.com/zigpy/zha/releases/tag/0.0.32

https://github.com/zigpy/zigpy/releases/tag/0.66.0

https://github.com/zigpy/zigpy/releases

@Camousse88
Copy link

same issue here

@Nukle0n
Copy link

Nukle0n commented Sep 19, 2024

#263 fixes it but has yet to be merged and released, you can download those 4 affected .py files and overwrite the ones on your HA install and then relaunch zha-toolkit (or reboot your HA install) and it works again.

@metallmanu
Copy link

Thank you, with #263 it works again for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests