Open erwin opened 2 years ago
I still haven't figured out how to get very useful troubleshooting information out of the HA log for the OpenRGB integration...
When I try to add a Linux OpenRGB Server
I'm getting this in the home-assistant.log
:
2022-06-16 15:29:52 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback _chain_future.<locals>._set_state(<Future pendi...tasks.py:416]>, <Future at 0x...StopIteration>) at /usr/local/lib/python3.9/asyncio/futures.py:378
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.9/asyncio/futures.py", line 380, in _set_state
_copy_future_state(other, future)
File "/usr/local/lib/python3.9/asyncio/futures.py", line 356, in _copy_future_state
dest.set_exception(_convert_future_exc(exception))
TypeError: StopIteration interacts badly with generators and cannot be raised into a Future
Looks like I need to set aside time for the Building a Home Assistant Custom Component 4 part tutorial to better understand how to debug this.
Apparently the dev container
stuff also will avoid 1-2 minute HA restarts.
https://aarongodfrey.dev/home%20automation/building_a_home_assistant_custom_component_part_1/
https://community.home-assistant.io/t/tutorial-for-creating-a-custom-component/204793/17
https://developers.home-assistant.io/docs/creating_component_index/
https://github.com/home-assistant/example-custom-config/tree/master/custom_components/
Also, there's a fork that's keeping up with this version - so good to check if there's anything there to learn from
https://github.com/koying/openrgb_ha/compare/master...FeikoJoosten:master
Made a bit of progress on this today.
If you want to work on any of this stuff, jump straight to Step 5: Debugging in the Home Assistant Component Tutorial
https://aarongodfrey.dev/home%20automation/building_a_home_assistant_custom_component_part_5/
Just load up the Microsoft's VisualStudio Code (not code-oss or codium) and install the "Remote Development Extensions". Then when you open VSCode, it will auto-build the Docker image.
Inside of the image, just clone this repo and make a symlink from config/custom_components/openrgb
to openrgb/custom_components/openrgb
, set some breakpoints and start debugging.
The first issue is that there hasn't been a openrgb_python
for year, but there are a quite a few new commits. By upgrading to the head
of openrgb_python
, I was able to at least get the openrgb_ha integration to add.
sudo pip install -e git+https://github.com/jath03/openrgb-python.git@6e8ce215b211f17aff8f09d0c72cead894eb5b8d#egg=openrgb-python
Now I'm getting back an empty device_list
inside of async_poll_devices_update()
, yet the openrgb profiles are being loaded, so the connection is at least partially working.
Next step for me is to write a simple script directly using openrgb-python
and see if I can grab the OpenRGB entities, since in init.py
device_list keeps on coming in empty.
Linux Host:
The message
Unable to Connect
in the config flow UI seems incomplete, as it is connecting enough that OpenRGB sees theClient Name: Home Assistant
passed in.Windows Host:
Meanwhile, when I choose a windows host in the config flow, it works fine.
Note that the Windows Host doesn't have any actual OpenRGB devices - it's a laptop without RGB, so I can't say for 100% certain that the issue is just Windows vs Linux hosts. Just want to clarify that.
Debug Log
Also, to get some helpful debugging in the log, normally this works, but not for openrgb.
Is there somewhere else that I can check for the name to use - I presume it's the custom_component folder name, but maybe that's not what HA uses to determine which log category to use...
Thanks!
This looks like it is a very cool integration!
Thanks so much for putting so much work into building it!
I sure hope that I'm able to get to the bottom of getting it working!