OpenRGB + Home Assistant

Hello guys!

Has anyone here integrated this great project with Home Assistant? https://gitlab.com/CalcProgrammer1/OpenRGB

This is a great solution to control your Aura and compatible RGB devices of your computer without any other proprietary software, works beautifully.

It would be great to be able to control my PC lights using HA, so automations and scripts can change its colors.

It has a headless server so I think it is possible to do it. Has anyone here tried this?

Thanks!

5 Likes

I recently discovered openrgb, it looks like there is a fork being worked on (it is not my work) to integrate openrgb in to Home Assistant.

In theory you could copy the openrgb folder found under homeassistant>components into custom_components (basically what HACS does). I did and the integrations flow was available but unfortunately my rig that has RGB is currently offline awaiting a 3080 in the mail and will likely be another two or three weeks for me to confirm.

1 Like

Wow! That’s amazing! Will try it ASAP and let you know. Thanks!

Has anybody been able to get this to work?
I can add it in the ui, but it says unable to connect.

Me too, same behavior… I can even see HA client connected to the OpenRGB server on the main app and it doesn’t work.

That sounds not very hopeful, OpenRGB isn’t very mature yet and is moving reasonably quickly. If I have success at some point, I will let you know.

Just threw this together. Works fine for simple colors changing, and most importantly emulated hue.
Start the python script on the same computer as openrgb, and add the switches to your ha config file.

Obviously not the right solution to this problem, but it does what I need it to do

2 Likes

I’m currently using a script I wrote to treat openrgb as a mqtt light:

This will let you treat it as a normal RGB light (you can select arbitrary colors, set brightness etc). It should be cross-platform and keep working as long as the openrgb-python library is up to date.

This could also easily be extended to add effects, multiple entities etc…

1 Like

A more established way I have been doing this on Windows 10 is with IoTLink and the command addon. Here is an example to change device 0 (RAM Slot 1 in my case) to static white:

- service: mqtt.publish
  topic: "iotlink/workgroup/desktop/commands/run"
  payload: '{ "command": "C:\\OpenRGB\\OpenRGB.exe", "args": "-d 0 -c ffffff -m direct", "path": "C:\\OpenRGB\\", "user": "", "visible": true, "fallback": true}'

Hitting the OpenRGB SDK can do everything the GUI can and calling your .orp file will likely be the easiest option. Here is how to list your devices:

OpenRGB.exe --list-devices

Here is how to find all the available options for the SDK:

OpenRGB.exe --help
1 Like

That is amazing! Thanks for sharing.

I already had IOTLink set up but didn’t realise I could use it with OpenRGB. Thanks @Yenoromm!

I’ve tried to import the WIP that come from the current submitted PR as a custom components and it seems to work quite good (tested only for a few hours).

Same here. The PR works pretty well as a custom component.
Not sure if @bahorn is around here, but it would be worth submitting to HACS I think.

I can do it if he agrees to…

The component is available at koying/openrgb_ha: OpenRGB integration for Home Assistant (github.com)

Available in HACS…

6 Likes

Do we have any updates in this topic? I’m thinking about letting openRGB control my RGB lightbulbs connected to HA, do we have any final integration for that?

This service doesn’t seem to work anymore, it won’t connect to OpenRGB, just throws an unknown error

If you’re referring to this, it’s working perfectly for me on two computers based on a release of OpenRGB from last month.

Have you recently updated to a new build of OpenRGB?

I’ve just started with OpenRGB, so I have the latest everything. I’ve even tried the experimental.
Found this in the logs.

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, 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 80, 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 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 181, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 296, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 392, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/openrgb/config_flow.py", line 76, in async_step_user
    await asyncio.wait_for(
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/openrgb/config_flow.py", line 24, in _try_connect
    conn = OpenRGBClient(_host, _port, name=_client_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openrgb/orgb.py", line 287, in __init__
    self.comms.requestDeviceNum()
  File "/usr/local/lib/python3.11/site-packages/openrgb/network.py", line 188, in requestDeviceNum
    self.read()
  File "/usr/local/lib/python3.11/site-packages/openrgb/network.py", line 116, in read
    self.callback(device_id, packet_type, buff[0])
  File "/usr/local/lib/python3.11/site-packages/openrgb/orgb.py", line 302, in _callback
    self.comms.requestDeviceData(x)
  File "/usr/local/lib/python3.11/site-packages/openrgb/network.py", line 181, in requestDeviceData
    self.read()
  File "/usr/local/lib/python3.11/site-packages/openrgb/network.py", line 137, in read
    self.callback(device_id, packet_type, utils.ControllerData.unpack(data, self._protocol_version))
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openrgb/utils.py", line 552, in unpack
    mode = ModeData.unpack(data, version, x)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openrgb/utils.py", line 327, in unpack
    color_mode = ModeColors(parse_var('I', data))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 711, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 1128, in __new__
    raise ve_exc
ValueError: 64 is not a valid ModeColors

I’m certainly no expert, but it looks like the integration is struggling with on-boarding one of your devices.

It might be worth trying to disable each one in OpenRGB and adding one at a time to the integration to see what it fails on. In the mean time, you should create an issue on the integration’s repo with as much information as you ahve.

Thanks for your advice. I found the offending device. With it disabled, things are starting to work.

1 Like