DallasHoff / homebridge-openrgb

Control the RGB lighting of your PC components and peripherals with HomeKit.
https://www.npmjs.com/package/homebridge-openrgb
Apache License 2.0
12 stars 0 forks source link

On Linux, accessory is detected as a new one after reboot #12

Open abrvham opened 1 year ago

abrvham commented 1 year ago

Describe The Bug:

When the computer restarts, the same accessory is detected as a new accessory (and the previous one becomes unreachable. Thus, every scenes gets messed up. (The accessory is always pluged in when the OpenRGB server is up)

To Reproduce: Shutdown the computer, restart the computer. Start OpenRGB: openrgb --server (doing it via systemctl)

Expected behavior:

The accessory is recognized as a previously added accessory.

Logs:

[6/13/2023, 5:52:56 PM] [OpenRGB] Adding new accessory: NZXT Kraken X3

Plugin Config:

{ "name": "OpenRGB", "servers": [ { "name": "xxxx", "host": "192.168.xxxx.xxxx", "port": 6742 } ], "discoveryInterval": 60, "preserveDisconnected": true, "suppressConnectionErrors": false, "platform": "OpenRgbPlatform" }

Environment: Ubuntu for the computer AND homebridge. NZXT Kraken X3 device

DallasHoff commented 1 year ago

Could you provide the information that the OpenRGB application lists in the Information tab for that cooler? Name, location, serial number, etc. Does any of that information change after a reboot? Does this happen with other devices or just that cooler?

abrvham commented 1 year ago

Sure Before reboot:

0: NZXT Kraken X3
  Type:           LED Strip
  Description:    NZXT Hue 2 Device
  Version:        2.1.0
  Location:       HID: /dev/hidraw5
  Serial:         00000000001A
  Modes: [Direct] Static Fading 'Spectrum Cycle' Marquee 'Cover Marquee' Alternating Pulsing Breathing Candle 'Starry Night' 'Super Rainbow' 'Rainbow Pulse' 'Rainbow Flow'
  Zones: 'Hue 2 Channel 1' 'Hue 2 Channel 2' 'Hue 2 Channel 3'
  LEDs: 'Hue 2 Channel 1, LED 1' 'Hue 2 Channel 1, LED 2' 'Hue 2 Channel 1, LED 3' 'Hue 2 Channel 1, LED 4' 'Hue 2 Channel 1, LED 5' 'Hue 2 Channel 1, LED 6' 'Hue 2 Channel 1, LED 7' 'Hue 2 Channel 1, LED 8' 'Hue 2 Channel 1, LED 9' 'Hue 2 Channel 1, LED 10' 'Hue 2 Channel 1, LED 11' 'Hue 2 Channel 1, LED 12' 'Hue 2 Channel 1, LED 13' 'Hue 2 Channel 1, LED 14' 'Hue 2 Channel 1, LED 15' 'Hue 2 Channel 1, LED 16' 'Hue 2 Channel 2, LED 1' 'Hue 2 Channel 2, LED 2' 'Hue 2 Channel 2, LED 3' 'Hue 2 Channel 2, LED 4' 'Hue 2 Channel 2, LED 5' 'Hue 2 Channel 2, LED 6' 'Hue 2 Channel 2, LED 7' 'Hue 2 Channel 2, LED 8' 'Hue 2 Channel 3, LED 1'

After reboot:

0: NZXT Kraken X3
  Type:           LED Strip
  Description:    NZXT Hue 2 Device
  Version:        2.1.0
  Location:       HID: /dev/hidraw1
  Serial:         00000000001A
  Modes: [Direct] Static Fading 'Spectrum Cycle' Marquee 'Cover Marquee' Alternating Pulsing Breathing Candle 'Starry Night' 'Super Rainbow' 'Rainbow Pulse' 'Rainbow Flow'
  Zones: 'Hue 2 Channel 1' 'Hue 2 Channel 2' 'Hue 2 Channel 3'
  LEDs: 'Hue 2 Channel 1, LED 1' 'Hue 2 Channel 1, LED 2' 'Hue 2 Channel 1, LED 3' 'Hue 2 Channel 1, LED 4' 'Hue 2 Channel 1, LED 5' 'Hue 2 Channel 1, LED 6' 'Hue 2 Channel 1, LED 7' 'Hue 2 Channel 1, LED 8' 'Hue 2 Channel 1, LED 9' 'Hue 2 Channel 1, LED 10' 'Hue 2 Channel 1, LED 11' 'Hue 2 Channel 1, LED 12' 'Hue 2 Channel 1, LED 13' 'Hue 2 Channel 1, LED 14' 'Hue 2 Channel 1, LED 15' 'Hue 2 Channel 1, LED 16' 'Hue 2 Channel 2, LED 1' 'Hue 2 Channel 2, LED 2' 'Hue 2 Channel 2, LED 3' 'Hue 2 Channel 2, LED 4' 'Hue 2 Channel 2, LED 5' 'Hue 2 Channel 2, LED 6' 'Hue 2 Channel 2, LED 7' 'Hue 2 Channel 2, LED 8' 'Hue 2 Channel 3, LED 1'

The location seems to change. However it's seems like a normal behavior in Ubuntu (at least)?

abrvham commented 1 year ago

I've rebuilt your project after removing the location from the uuid calculation and it works well. I don't know if the location stays the same on Windows platform but on Linux, the HID will change after reboot because it will depend of the order they are mounted.

A quick fix would be to add a setting to disable the location from the UUID calculation (even tho it means that users should be sure that the name of their OpenRGB devices are differents).

DallasHoff commented 1 year ago

Hmm, it's tricky because from what I've seen, it's common for devices to report a fake or empty serial number (all but one of my devices do, for instance) and device names can easily be the same (e.g. a pair of RAM sticks). That's why location is used in the UUID calculation since #1. On Windows, it does stay the same. I'm not sure how to make it reliable for Linux too. Maybe OpenRGB could be updated to provide the device's UUID from Linux instead of its /dev path? I'll look into it.