koying / openrgb_ha

OpenRGB integration for Home Assistant
110 stars 18 forks source link

Multiple PCs integrated into Home Assistant (Add a second host in the integration config) #11

Closed LeoLTM closed 2 years ago

LeoLTM commented 3 years ago

I want to integrate my two machines running OpenRGB into Home Assistant. The setup of the first one worked perfect (Installed OpenRGB, started server, installed HACS Integration, added in integrations section, entered IP of the first desktop), but I was not able to find a way to add a second desktop with a different IP address to the openRGB integration.

malkie-hass commented 2 years ago

Same issue here. Would like to add more than only one PC.

Sjorsa commented 2 years ago

I get this "aborted" error when trying to add a 2nd PC. image I guess the integration is not set up to handle multiple instances?

LeoLTM commented 2 years ago

Yeah, sadly there is no way to connect a 2nd or 3rd machine yet... Would be very useful!

WhimsySpoon commented 2 years ago

Agreed. Have multiple PCs in a single room and would love to be able to control the colours at the same time.

stoniwankenobii commented 2 years ago

If not multiple PCs but multiple IPs, I guess loosely multiple PCs, would be fantastic! I sometimes forget to plug my ethernet cable back into my main PC and would love to add both IP addresses for my WiFi MAC and Ethernet MAC to ensure I am always able to control my lights. I use this extension with Lumia Streams integration of Home Assistant to help add effects for things when I stream. Other than this no issue at all!

WhimsySpoon commented 2 years ago

Thanks for taking care of this, @koying! Unfortunately I've encountered a minor bug with this. When adding a second instance of the integration, it finds the new devices from the new computer, but also the devices found from the first instance.

For example, if the first instance has 4 devices, and the second instance has 3, upon adding the second computer, 7 devices are reported as being added.

The devices for the first computer are now tied to both instances of the integration (see last four devices in the screenshot below):

image

WhimsySpoon commented 2 years ago

Been experimenting with this a bit more. When a second device is added, the entities from the first device are sometimes allocated to the second device, and the ones for the second device are lost.

I've been poking around in config_entities, device_registry and entity_registry and when additional devices are added, the links between the entities -> devices become mismatched.

What might be relevant: I have two identical computers that I'm adding, so the devices will share the same model numbers etc.

WhimsySpoon commented 2 years ago

I have removed both instances, added one, then set logging level for the component to debug then added a second instance. The following appeared in the log:

2022-02-12 21:54:59 INFO (MainThread) [homeassistant.components.light] Setting up light.openrgb
2022-02-12 21:54:59 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.openrgb entity: light.asus_rog_strix_rtx_2070s_a8g_gaming_8g_0
2022-02-12 21:54:59 ERROR (MainThread) [homeassistant.components.light] Platform openrgb does not generate unique IDs. ID light.corsair_vengeance_pro_rgb_1 already exists - ignoring light.ddp_desktop_01_ram_0
2022-02-12 21:54:59 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.openrgb entity: light.corsair_vengeance_pro_rgb_2
2022-02-12 21:54:59 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.openrgb entity: light.asus_rog_crosshair_vii_hero_wi_fi_3
2022-02-12 21:54:59 ERROR (MainThread) [homeassistant.components.light] Platform openrgb does not generate unique IDs. ID 00000000001A already exists - ignoring light.ddp_desktop_01_case
2022-02-12 21:55:11 ERROR (MainThread) [homeassistant.components.light] Platform openrgb does not generate unique IDs. ID light.corsair_vengeance_pro_rgb_0 already exists - ignoring light.ddp_desktop_01_ram_1
2022-02-12 21:55:11 ERROR (MainThread) [homeassistant.components.light] Platform openrgb does not generate unique IDs. ID light.corsair_vengeance_pro_rgb_1 already exists - ignoring light.ddp_desktop_01_ram_0
2022-02-12 21:55:11 ERROR (MainThread) [homeassistant.components.light] Platform openrgb does not generate unique IDs. ID light.asus_rog_crosshair_vii_hero_(wi-fi)_2 already exists - ignoring light.ddp_desktop_01_motherboard
2022-02-12 21:55:11 ERROR (MainThread) [homeassistant.components.light] Platform openrgb does not generate unique IDs. ID 00000000001A already exists - ignoring light.ddp_desktop_01_case

The devices that share the same name will reappear as ERRORs in the log every ~20 seconds after the initial view. It appears that the component is attempting to add the entities using their model names name. One of my computers has a different GPU which can be added without issue (light.asus_rog_strix_rtx_2070s_a8g_gaming_8g_0).

WhimsySpoon commented 2 years ago

Latest release (2.2) resolves this. Thank you!