dcmeglio / homeassistant-waste_management

Determines your next Waste Management (https://www.wm.com) pickup times for use in Home Assistant.
7 stars 0 forks source link

Unknown error when trying to set up the integration and sign in #10

Open reebgogs opened 10 months ago

reebgogs commented 10 months ago

"Unknown error occurred"

I confirmed that I am using the correct username/password by signing into wm.com

Please advise

schergr commented 10 months ago

I had a similair problem when installing this morning. I messed up the paspword entry on the first try. Second try I got it right, but the flow had broken. I had to remove the integration, and re-add it. Then it worked.

reebgogs commented 10 months ago

Thanks for the tip. Unfortunately, it didn't help mine. I uninstalled Waste Management from HACS, restarted HA, added Waste Management to HACS, restarted HA, added Waste Management as an Integration and got the same error. I confirmed that my username/password works on the wm.com site.

dcmeglio commented 10 months ago

Unfortunately I no longer have waste management service, so I'm not able to test as I can't access the system without a username and password. If someone else raises a PR to fix the issue I'm happy to review and merge.

azchohfi commented 3 months ago

It listed my service address properly, but it fails when I select the address and click on Submit. On the logs, I see an error on this line: https://github.com/dcmeglio/homeassistant-waste_management/blob/ea9c50526a5a79a503e2751ea30b0755ea9513b7/custom_components/waste_management/config_flow.py#L122

azchohfi commented 3 months ago
Logger: custom_components.waste_management.config_flow
Source: custom_components/waste_management/config_flow.py:122
integration: Waste Management ([documentation](https://github.com/dcmeglio/homeassistant-waste_management/blob/master/README.md), [issues](https://github.com/dcmeglio/homeassistant-waste_management/issues))
First occurred: 5:52:03 PM (7 occurrences)
Last logged: 6:02:05 PM

Unexpected exception Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/config/custom_components/waste_management/config_flow.py", line 122, in async_step_services
    self.wmData.services = await self._wmclient.async_get_services(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/waste_management/client.py", line 154, in async_get_services
    jsonData = await self.async_api_get(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/waste_management/client.py", line 271, in async_api_get
    return json.loads(response.content.decode("UTF-8"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
azchohfi commented 3 months ago

There was another log with more details:

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 415, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 518, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/waste_management/config_flow.py", line 114, in async_step_accounts
    return await self.async_step_services()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/waste_management/config_flow.py", line 128, in async_step_services
    self._services = {x.id: x.name for x in self.wmData.services}
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable
dcmeglio commented 3 months ago

Unfortunately I no longer have a Waste Management account. WM significantly increased prices in my area forcing me to switch providers. If someone is interested in submitting a PR, I'd be happy to include it, but unfortunately without an account I can't fix it myself.

azchohfi commented 3 months ago

I'm happy to help debug this on my instance, but I'm not that familiar with Home Assistant extensions. Any pointers into how I can debug this?

dcmeglio commented 3 months ago

You'd run Home Assistant in a vscode dev container and step through the extension using debugpy. https://developers.home-assistant.io/docs/development_environment/ https://www.home-assistant.io/integrations/debugpy/

azchohfi commented 3 months ago

I'll give that a go later, thank you!