sebr / bhyve-home-assistant

Orbit BHyve custom component for Home Assistant
MIT License
259 stars 42 forks source link

Setup Not Working #153

Closed spiralfive closed 2 years ago

spiralfive commented 2 years ago

Hello, I have been trying to setup this integration now for the past week. I installed this via HACS and then went to 'Add Integration'. The option appears and it prompts me for my login information, however after doing this I get an error each time in the GUI of "Failed to Connect". This is why I tried this over several days, I was thinking maybe the servers were down.

I am using the following HA software:

image

I am using the 3.0.0 version of this from HACS. The error from the log is below.

This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/bhyve/config_flow.py:93
Integration: Orbit B-hyve (documentation)
First occurred: 11:52:04 AM (1 occurrences)
Last logged: 11:52:04 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 277, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/bhyve/config_flow.py", line 70, in async_step_user
    return await self.async_step_device()
  File "/config/custom_components/bhyve/config_flow.py", line 92, in async_step_device
    device_options = {
  File "/config/custom_components/bhyve/config_flow.py", line 93, in <dictcomp>
    str(d["id"]): f'{d["name"]}'
KeyError: 'name'
sebr commented 2 years ago

Hi @spiralfive , can you please update to version 3.0.1 which includes some extra debug logging. You'll need to add the following into configuration.yaml:

logger:
  logs:
    custom_components.bhyve: debug
    pybhyve: debug

Please restart after adding this & updating, then check the logs for a line which starts with Devices: and please paste the output here.

Thanks!

spiralfive commented 2 years ago

I just updated and tried that - the only thing I see with the phrase "Devices:" is for my ecovacs integration. I am getting the same error I was before now, except now I do not see anything in the logs when I get the errors like I was before. I skim read the log for anything else and could not find anything that looked related.

I was going to attach the log, but it is already a 20mb file.

This is probably not helpful - but the response the browser gets when trying to login is below {"type":"form","flow_id":"c1aac74fff8f36b81e5a60e08f936e09","handler":"bhyve","step_id":"user","data_schema":[{"type":"string","name":"username","required":true},{"type":"string","name":"password","required":true}],"errors":{"base":"cannot_connect"},"description_placeholders":null,"last_step":null}

I looked for "cannot_connect" in the logs as well and was not able to find that message.

sebr commented 2 years ago

Can you check if there are any Devices or Zones which are unnamed in your B-hyve app? I think this might be the root cause.

spiralfive commented 2 years ago

That was it! The last timer I added had a blank name set, I didn’t realize that. I have it a name and it immediately started working. Thank you!