koying / openrgb_ha

OpenRGB integration for Home Assistant
110 stars 18 forks source link

Seems to connect to SDK Server, but still get an "Unknown error occurred" when setting up integration #2

Closed RevolverUnit closed 3 years ago

RevolverUnit commented 3 years ago

Like it says in the title. HA shows up as "Client" in the OpenRGB SDK despite setting Client Name to the default Home Assistant.

System Info: version core-2021.4.6
installation_type Home Assistant Core
dev false
hassio false
docker false
virtualenv true
python_version 3.8.9
os_name FreeBSD
os_version 12.2-RELEASE-p3
arch amd64

Log entry:

Logger: aiohttp.server
Source: custom_components/openrgb/config_flow.py:24
First occurred: 9:20:37 PM (2 occurrences)
Last logged: 9:21:43 PM
Error handling request

Traceback (most recent call last):
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 131, in handle
    result = await result
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/config/config_entries.py", line 155, in post
    return await super().post(request, flow_id)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/data_validator.py", line 60, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/data_entry_flow.py", line 107, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 156, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 214, in _async_handle_step
    result: dict = await getattr(flow, method)(user_input)
  File "/home/homeassistant/homeassistant/custom_components/openrgb/config_flow.py", line 76, in async_step_user
    await asyncio.wait_for(
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/homeassistant/custom_components/openrgb/config_flow.py", line 24, in _try_connect
    conn = OpenRGBClient(_host, _port, name=_client_id)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/openrgb/orgb.py", line 263, in __init__
    self.comms = NetworkClient(self._callback, address, port, name, protocol_version)
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/openrgb/network.py", line 42, in __init__
    self.start_connection()
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/openrgb/network.py", line 64, in start_connection
    self.send_header(0, utils.PacketType.REQUEST_PROTOCOL_VERSION, struct.calcsize('I'))
  File "/usr/local/share/homeassistant/lib/python3.8/site-packages/openrgb/network.py", line 204, in send_header
    sent = self.sock.send(data, NOSIGNAL)
NameError: name 'NOSIGNAL' is not defined
koying commented 3 years ago

I suspect freebsd is not properly handled in the backend lib, here: https://github.com/jath03/openrgb-python/blob/8faea11db7f9372f82f0071deb938737dded4a94/openrgb/network.py#L11

Could forward the ticket to https://github.com/jath03/openrgb-python, please

Thanks

RevolverUnit commented 3 years ago

Thank you, I will pass this ticket on

RevolverUnit commented 3 years ago

I've yet to confirm this for myself, but according to the dev openrgb-python, this has been fixed as of 656ef76

I'm not well versed with python, would it be correct that updating the version used by openrgb-ha would fix this issue?

koying commented 3 years ago

Until a new release is created, you would have to do: pip3 install git+https://github.com/jath03/openrgb-python#egg=openrgb-python in your HA environment

jath03 commented 3 years ago

@koying I released 0.2.9, which should close this issue, as well as solve some other problems with disconnecting and not reconnecting.

RevolverUnit commented 3 years ago

I was unable to update openrgb-python manually, but this latest update to the integration has fixed the issue. Works perfectly with HA on FreeBSD now. Thank you.