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.10.1] Exception ''DataClass' object has no attribute '__name__'' for service call with data #268

Closed
ghost opened this issue Oct 11, 2024 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 11, 2024

New exception occurred after modifying python scripts listed in #263.

Exception ''DataClass' object has no attribute '__name__'' for service call with data '{'zha_toolkit_version': 'v1.1.19', 'zigpy_version': '0.67.0', 'zigpy_rf_version': '0.40.6', 'ieee_org': a4:c1:38:6c:ba:c8:a6:7b, 'ieee': 'a4:c1:38:6c:ba:c8:a6:7b', 'command': 'scan_device', 'command_data': None, 'start_time': '2024-10-11T16:14:44.054102+00:00', 'errors': ['AttributeError("\'DataClass\' object has no attribute \'__name__\'")'], 'params': {'dir': 0, 'tries': 1, 'expect_reply': True, 'args': [], 'read_before_write': True, 'read_after_write': True}, 'success': False}'

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'DataClass' object has no attribute '__name__'
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 835, in toolkit_service
    raise RuntimeError("Success expected, but failed")
        ^^^^^^^^^^^^^^^^^^^^^^^
  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 898, 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/scan_device.py", line 466, in scan_device
    scan = await scan_results(
           ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/scan_device.py", line 83, in scan_results
    await scan_endpoint(ep, manufacturer, tries=tries)
  File "/config/custom_components/zha_toolkit/scan_device.py", line 112, in scan_endpoint
    clusters[key] = await scan_cluster(
                    ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/scan_device.py", line 139, in scan_cluster
    attributes = await discover_attributes_extended(cluster, None, tries=tries)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/scan_device.py", line 240, in discover_attributes_extended
    attr_type.type_class.__name__,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DataClass' object has no attribute '__name__'. Did you mean: '__hash__'?
@PekaJ
Copy link

PekaJ commented Oct 19, 2024

change attr_type.type_class.__name__ to attr_type.type_class.name in line 240 of scan_device.py

@ghost
Copy link
Author

ghost commented Oct 23, 2024

change attr_type.type_class.__name__ to attr_type.type_class.name in line 240 of scan_device.py

Thank you, it works

@ghost ghost closed this as completed Oct 23, 2024
This issue was closed.
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

1 participant