custom-components / sensor.avfallsor

Simple sensor for avfallsor
MIT License
8 stars 6 forks source link

"Unknown error occured" during config flow #8

Closed Skeletorjus closed 3 years ago

Skeletorjus commented 3 years ago

After installing the new version I get an error while trying to add my address/street ID.

Here's the log. I have removed my address and street ID, but I've confirmed that the correct ID is resolved.

2020-12-09 10:53:59 DEBUG (MainThread) [custom_components.avfallsor.utils] street_id was not set
2020-12-09 10:53:59 DEBUG (MainThread) [custom_components.avfallsor.utils] Trying to find the id using url https://avfallsor.no/wp-json/addresses/v1/address, params {'address': 'My Address 00'}
2020-12-09 10:53:59 DEBUG (MainThread) [custom_components.avfallsor.utils] Raw response:

 {
    "My Address 00": {
        "value": "My Address 00",
        "label": "My Address 00, Kristiansand",
        "href": "https://avfallsor.no/henting-av-avfall/finn-hentedag/my-street-id-hash",
        "index": 0,
        "global_count": 1,
        "global_offset": 1,
        "last_offset": 1
    }
}
2020-12-09 10:53:59 DEBUG (MainThread) [custom_components.avfallsor.utils] Getting the tomme plan page https://avfallsor.no/henting-av-avfall/finn-hentedag/my-street-id-hash/
2020-12-09 10:53:59 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 169, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 155, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 213, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/config/custom_components/avfallsor/config_flow.py", line 131, in async_step_user
    adr = await self.test_setup(user_input)
  File "/config/custom_components/avfallsor/config_flow.py", line 95, in test_setup
    if check_tomme_kalender(text) is True:
  File "/config/custom_components/avfallsor/utils.py", line 116, in check_tomme_kalender
    tomme_kalender = parse_tomme_kalender(data)
  File "/config/custom_components/avfallsor/utils.py", line 55, in parse_tomme_kalender
    soup = BeautifulSoup(text, "html5lib")
  File "/usr/local/lib/python3.8/site-packages/bs4/__init__.py", line 193, in __init__
    raise FeatureNotFound(
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?

Edit: Removed a part of your address that you had forgotten.

Hellowlol commented 3 years ago

Crap, i already had html5lib installed because of another integration. Anyway, should be fixed now.

Skeletorjus commented 3 years ago

This fixed the issue! Thanks!