Breina / 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
124 stars 10 forks source link

Transition is flickering #46

Closed LexanRed closed 9 months ago

LexanRed commented 1 year ago

Hi there,

I have trouble with smooth transitions, strangely only when turning off.

Currently three different dimmers are used, all support 16 Bit resolution. One is RGBW, one RGBWW and one is a two channel dimmer for warm white and cold white.

Different brands, all of them support a manual mode in which the transitions work fine (testing all the channels, switching from channel to channel is done with a smooth transition). Meaning the dimmers cannot be the problem here.

If I use other software like LightKey to dimm them, it is also not a problem. Meaning that the ArtNet interface is also not the problem.

The problem only occurs when using home assistant and turning the lights off. It doesnt matter how long the transition takes, happens with .3 seconds as well as 1 second. Shortly before turning of the light flickers. It does not brighten up, but rather turns the LEDs off when they should smooth out. Like HA sends a few 0 too early, then continues with the transition. This happens not randomly but always in a similar / same way.

When using 8 bit, the transition is not that smooth to begin with, because we only got 256 values, therefore I cannot tell whether the problem only applies to 16 bit fixtures.

Do you have any idea, what could be the issue here?

P.S.: Thanks for the great implementation, it works really well and reliably (except this tiny issue mentioned above).

Breina commented 1 year ago

So I can investigate, which node_type are you using?

LexanRed commented 1 year ago

We are using artnet-direct for all of them.

LexanRed commented 1 year ago

I tried different scenarios again. The problem also happens when dimming from 100% to 1%, it flickers shortly before arriving at the 1% brightness. So I guess it might happen with every transition, but I am only able to see it when making big jumps in brightness.

To be sure it is not my setup, I played around with the settings on the dimmer like PWM frequency and dimming curve. The problem only happens when using home assistant.

If I setup a 16 bit fixture in LightKey, all transitions are smooth.

Breina commented 11 months ago

Sorry for the late reply. If you still have this issue, can you maybe try setting byte_order to little?

lgoette commented 11 months ago

I got the same Issue. In my case, it flickers when using a fade at turning the light on. It fades normal but when almost at 100% it turns off completely for a brief moment and then turns back on at 100%. When using a fade between scenes when the light is already on, it works fine.

Unfortunatly setting byte_order to little did not change anything.

Its definitely a bug in this repo because I did not change my setup and it worked fine on a old custom component. I have this Issue after switching to hacs and using this repo.

Breina commented 11 months ago

Ok let's get to the bottom of this, I have some questions;

  1. Can you manually set the light brightness to a specific % and have it go dark when it shouldn't be?
  2. As an experiment, please set up a dimmer as 8 bit only and test channel per channel. If this does work properly, it means that the fault is endianness (and there's a big in it not reacting to you changing it).
  3. If your ArtNet node shows a universe's values, can you compare what this repo is sending vs something that works is sending?
lgoette commented 11 months ago

Hi, i found the issue. The Issue is my Hardware. In my case the channelsetup for the dimmer channel is split into functions. I got the Lightmaxx led par 64 with 10mm led variant and it says the following in the manual:

000-189:  Dimmer
189-250:  Strobe
250-255:  No function

The no function bit is just maximum brightness and when it gets to the strobe part, I get flickering for obvious reasons. I think that the difference to the old repo is that the "255", I set for the fourth channel was not affected by the brightness level in home-assistant and just the defined r,g,b channels were dimmed. But in this repo the brightness level is affecting the channel that has a constant value too.

Breina commented 11 months ago

Ah that makes sense! I'm working on making lights compatible with openfixturelibrary, that includes a feature to have multiple features per channel like you have. So this will be fixed in due time (a lot of work ahead still).

lgoette commented 11 months ago

That sounds cool. For a quick fix, can you give me some insights, how the dimming works on channels with a constant value? When I set a channel to 189, is 100% in Homeassistant 189 dmx value?

Breina commented 11 months ago

Yeah HA sends 255 itself at max value (attribute brightness as opposed to brightness_pct on service light.turn_on).

You can manually edit this file in your custom_components to this:

self._attr_brightness = int(kwargs[ATTR_BRIGHTNESS] * 189 / 255)

lgoette commented 11 months ago

I think this solution is for the RGB Channels that get set by HA? In my case the strobe function is just in channel no. 4 (the master-dimmer channel). That channel was set to a constant value 255 in my configuration.yaml. When the lights are turned off, HA (or this repo, idk) sets all dmx values to 0 also the constant ones. When a fade happens, also the constant value gets faded to 0 and there it crosses the strobe part. I fixed it now by setting the constant value to 189 in my configuration. Now it just fades between 0 and 189. Thanks for the advice :)

Breina commented 9 months ago

Closing issue: user fixed issue