corb3000 / ha-artnet-led

DMX lighting Integration for Home Assistant. Using the HA Color Mode update and Pyartnet library to control lights in multiple DMX universes over ethernet with the Art-Net protocol.
MIT License
26 stars 18 forks source link

Support for the drgb type (dimmer, red, green, blue) #14

Closed jacobmellin closed 1 year ago

jacobmellin commented 1 year ago

There are some obscure (or possibly not so obscure) dmx fixtures that use the following format:

With the dimmer controlling the brightness of the three other values.

It would be nice if this type were configurable for dmx devices (as hass_dmx allowed).

If I am not mistaken, a brightness slider that is separate from the RGB values should be supported by Home Assistant lights.

jacobmellin commented 1 year ago

So I figured out that you can get this behaviour by setting the following:

type: rgb
channel_setup: drgb

However, this results in the RGB values being scaled by the brightness value, in addition to the dimmer value being sent to the first channel.

If I read the documentation correctly, the following should set the RGB values unscaled:

type: rgb
channel_setup: dRGB

However, this results in the following error:

Error while setting up artnet_led platform for light
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/homeassistant/helpers/entity_platform.py", line 320, in _async_setup_platform
    await asyncio.shield(task)
  File "/var/lib/hass/custom_components/artnet_led/light.py", line 146, in async_setup_platform
    await entity_registry.async_load()
  File "/usr/lib/python3.11/site-packages/homeassistant/helpers/entity_registry.py", line 952, in async_load
    data = await self._store.async_load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/homeassistant/helpers/storage.py", line 122, in async_load
    return await self._load_task
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/homeassistant/helpers/storage.py", line 131, in _async_load
    return await self._async_load_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/homeassistant/helpers/storage.py", line 147, in _async_load_data
    data = deepcopy(data)
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 146, in deepcopy
    y = copier(x, memo)
        ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
                             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 146, in deepcopy
    y = copier(x, memo)
        ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
                             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 146, in deepcopy
    y = copier(x, memo)
        ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 206, in _deepcopy_list
    append(deepcopy(a, memo))
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 146, in deepcopy
    y = copier(x, memo)
        ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
                             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 297, in _reconstruct
    value = deepcopy(value, memo)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/copy.py", line 298, in _reconstruct
    y[key] = value
    ~^^^^^
  File "/usr/lib/python3.11/site-packages/homeassistant/util/read_only_dict.py", line 7, in _readonly
    raise RuntimeError("Cannot modify ReadOnlyDict")
RuntimeError: Cannot modify ReadOnlyDict
Breina commented 1 year ago

On what version of HA are you seeing this? People have been reporting this same error on my fork when upgrading to 2023.6.0.

jacobmellin commented 1 year ago

Hi, I am actually using your fork (unfortunately messed up and reported to the wrong repo).

I am using Home Assistant 2023.6.1, Frontend 20230608.0.

Breina commented 1 year ago

Fixed

jacobmellin commented 1 year ago

Thank you! :) I'm closing this issue since it is in the wrong repo. Will open again in the right repo if there are any problems.