Skip to content

"3072 is not a valid ModeColors" #69

Open

Description

@Bluscream
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:230
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 3:15:26 PM (3 occurrences)
Last logged: 3:15:34 PM

[547292370240] 3072 is not a valid ModeColors
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 580, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1265, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  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/light.py", line 173, in turn_on
    self._set_color()
  File "/config/custom_components/openrgb/light.py", line 334, in _set_color
    self._light.set_color(RGBUtils.RGBColor(*color))
  File "/usr/local/lib/python3.11/site-packages/openrgb/orgb.py", line 190, in set_color
    self.update()
  File "/usr/local/lib/python3.11/site-packages/openrgb/utils.py", line 670, in update
    self.comms.requestDeviceData(self.device_id)
  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 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: 3072 is not a valid ModeColors

Erroring device is:

Activity

  1. trajano commented on May 10, 2024

    @trajano

    The problem is on this line

    color_mode = ModeColors(parse_var('I', data))

    The reason for it is it's assuming that there is a limited set of ModeColors defined in

    class ModeColors(IntEnum):
    but the specs actually indicate that it is a uint32 and can vary between devices.

    As such that assumption on the possible ModeColors is incorrect, I am getting a similar issue as you are. What I did for now was hard code it to use MODE_SPECIFIC for now

            # color_mode = ModeColors(parse_var('I', data))
            parse_var('I', data)
            color_mode = ModeColors.MODE_SPECIFIC
    

    but ideally I think color_mode should be an integer.

  2. added a commit that references this issue on May 11, 2024
  3. jath03 commented on May 12, 2024

    @jath03
    Owner
  4. trajano commented on May 12, 2024

    @trajano

    Thanks I'll see if I can do something about it in my PR but feel free to modify the PR to match. The main purpose was to make sure it does not crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions