jath03 / openrgb-python

A python client for the OpenRGB SDK
GNU General Public License v3.0
112 stars 22 forks source link

OpenRGBDisconnected When Setting Color for Zone #47

Closed Neightro closed 2 years ago

Neightro commented 2 years ago

openrgb: 0.6 openrgb-python: 0.2.13

running this code:

import openrgb
from openrgb.utils import RGBColor, DeviceType

rgb = openrgb.OpenRGBClient()
cooler = rgb.get_devices_by_type(DeviceType.COOLER)[0] # AMD Wraith Prism
cooler_fan = cooler.zones[1]
cooler_fan.set_color(RGBColor(255, 255, 255))

results in this error after a few seconds:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.9/site-packages/openrgb/orgb.py", line 90, in set_color
    self.update()
  File "/usr/lib/python3.9/site-packages/openrgb/utils.py", line 664, in update
    self.comms.requestDeviceData(self.device_id)
  File "/usr/lib/python3.9/site-packages/openrgb/network.py", line 179, in requestDeviceData
    self.send_header(device, utils.PacketType.REQUEST_CONTROLLER_DATA, struct.calcsize('I'))
  File "/usr/lib/python3.9/site-packages/openrgb/network.py", line 210, in send_header
    raise utils.OpenRGBDisconnected("SDK server did not respond to previous request")
openrgb.utils.OpenRGBDisconnected: SDK server did not respond to previous request

Any further attempts to communicate with the server result in the same exception.

Neightro commented 2 years ago

I tried using the new code from master; I no longer get the disconnect, but the region turns black instead of turning to the specified color.

Thanks for your assistance. 🙂

jath03 commented 2 years ago

Hmm, that's strange. I can't reproduce this issue. Can you try setting the device to direct mode before changing the zone's color?

Neightro commented 2 years ago

Changing the mode of the cooler doesn't change the behavior, including setting to direct mode. I can confirm from the GUI that setting individual regions works correctly.

Let me know if there's anything I can do in terms of finding information or testing; I'm happy to help in any way I can

jath03 commented 2 years ago

Does v0.2.15 fix this?

Neightro commented 2 years ago

Confirmed working on 0.2.15. Thank you for your help!