jath03 / openrgb-python

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

Connection drops when doing set color and fast is disabled #61

Closed trajano closed 1 year ago

trajano commented 2 years ago

I have the following code based on the example

#!/usr/bin/env python3
from openrgb import OpenRGBClient
from openrgb.utils import RGBColor, DeviceType
import time

client = OpenRGBClient()

print(client)

print(client.devices)

keyboard = client.get_devices_by_type(DeviceType.KEYBOARD)[0]
client.clear() # btw example is wrong it should be .clear not .off

while True:
    for x in range(360):
        for led in keyboard.leds:
            led.set_color(RGBColor.fromHSV(x, 100, 100), fast=False)
        # client.set_color(RGBColor.fromHSV(x, 100, 100), fast=False)
        time.sleep(.05)

I get this

OpenRGBClient(address=127.0.0.1, port=6742, name=openrgb-python)
[Device(name=EVision Keyboard, id=0)]
Traceback (most recent call last):
  File "C:\Users\trajano\AppData\Roaming\Python\Python310\site-packages\openrgb\network.py", line 96, in read
    self.sock.recv_into(header)
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\trajano\onedrive\Shell Keys\spectrum.py", line 18, in <module>
    led.set_color(RGBColor.fromHSV(x, 100, 100), fast=False)
  File "C:\Users\trajano\AppData\Roaming\Python\Python310\site-packages\openrgb\orgb.py", line 42, in set_color
    self.update()
  File "C:\Users\trajano\AppData\Roaming\Python\Python310\site-packages\openrgb\utils.py", line 664, in update
    self.comms.requestDeviceData(self.device_id)
  File "C:\Users\trajano\AppData\Roaming\Python\Python310\site-packages\openrgb\network.py", line 181, in requestDeviceData
    self.read()
  File "C:\Users\trajano\AppData\Roaming\Python\Python310\site-packages\openrgb\network.py", line 99, in read
    raise utils.OpenRGBDisconnected() from e
openrgb.utils.OpenRGBDisconnected
trajano commented 2 years ago

I tried both 0.7 and the latest build from gitlab.

trajano commented 2 years ago

Similar to https://github.com/jath03/openrgb-python/issues/47

trajano commented 2 years ago

I am suspecting it is on the OpenRGB server side after I did a bit of debugging. https://gitlab.com/CalcProgrammer1/OpenRGB/-/issues/2780