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

TypeError: 'WMClient' object is not callable #14

Open
johntdyer opened this issue Dec 8, 2024 · 5 comments
Open

TypeError: 'WMClient' object is not callable #14

johntdyer opened this issue Dec 8, 2024 · 5 comments

Comments

@johntdyer
Copy link

2024-12-08 10:54:55.537 INFO (MainThread) [homeassistant.components.sensor] Setting up waste_management.sensor
2024-12-08 10:54:58.436 ERROR (MainThread) [homeassistant.components.sensor] waste_management: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 737, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1318, in async_device_update
    await self.async_update()
  File "/config/custom_components/waste_management/sensor.py", line 76, in async_update
    client = await self.hass.async_add_executor_job(WMClient(self.username, self.password))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
TypeError: 'WMClient' object is not callable
2024-12-08 10:54:58.440 ERROR (MainThread) [homeassistant.components.sensor] waste_management: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 737, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1318, in async_device_update
    await self.async_update()
  File "/config/custom_components/waste_management/sensor.py", line 76, in async_update
    client = await self.hass.async_add_executor_job(WMClient(self.username, self.password))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
TypeError: 'WMClient' object is not callable

Core - 2024.12.1
Supervisor 2024.11.4
OS - 14.0

@johntdyer
Copy link
Author

@dcmeglio should we consider this abandoned and possibly looking for adoption ?

@dcmeglio
Copy link
Owner

dcmeglio commented Jan 1, 2025

Yes. I no longer have waste management for my trash service so I can’t really provide any support for this.

@johntdyer
Copy link
Author

I would be happy to at least try and adopt the repo / project but I would need you to grant me appropriate access to do things like accept MR's and manage actions for the both repo's for release tasks. I could also fork it and you could deprecate and link to mine if that is better for you..

@ParagonDefect
Copy link

@johntdyer there might be a bug in your version of HomeAssistant that doesn't allow the python module to be loaded during startup. Depending on your sys.path, HomeAssistant will try to load the module during runtime when the sensor is added or updated, which is considered a blocking operation.

As a workaround, I copied the waste_management python module from /config/deps/ to /config/custom_components/waste_management/

I then updated config_flow.py & sensor.py files to load the classes from component's location instead of relying on the larger python environment.

Change line 14 of sensor.py & line 17 of config_flow.py from:
from waste_management import WMClient

to:
from .waste_management import WMClient

Restart HomeAssistant.

I don't know how long this will work nor what versions are all affected but it's something.

@johntdyer
Copy link
Author

@ParagonDefect - ok, but I am running HassOS, so arent those libraries immutable docker layers and just going to reset on restart?

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

3 participants