Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several issues with implementation #47

Open
klopyrev opened this issue Sep 25, 2023 · 2 comments
Open

Several issues with implementation #47

klopyrev opened this issue Sep 25, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@klopyrev
Copy link

I discovered several issues with the implementation that I ended up fixing in my own implementation of DMX control for lights that support color temperature + hue and saturation: https://github.com/klopyrev/ct_hs_artnet_led

  1. Hue / Saturation / Brightness + color temperature is generally a better way to tell lights which color to show, compared to RGB, since HSB + Color Temperature is more standard. There are many variants of RGB and it's hard to get RGB lights to show correct colors. For example, Astera lights have their own RGB color space: AsteraRGB Color Space. However, fading in the hue dimensions has a number of challenges. First, fading needs to go in the right direction and go across 0 (e.g. fading from hue 1 to 359 should go 1 -> 0 -> 359). Second, if fading from 0 saturation to non-zero saturation or vice verse, the hue dimension needs to be updated instantaneously instead of fading. If fading from on to off and vice verse, both hue and saturation should be updated instantaneously.
  2. Fading in a way that is visually nice is hard. There is a discussion on the topic here. I ended up using the colormath library to implement the fading in the LCH color space.
  3. The pyartnet library handles fade timing wrong. It adds a simple sleep for a fixed time period in each fade step, not accounting for 2 factors: that the fade computation takes non-negligible time, and that there are other things happening on the CPU meaning that the fade code may not get executed at exactly the time that it wants to.
  4. Configuration is generally fairly verbose in Breina/ha-artnet-led. In my version, I define a type of light and share configuration for several lights.
  5. I ended up changing channels for lights many times during setup. In Breina/ha-artnet-led, the DMX channel is used for the unique ID which makes moving lights from one channel to another hard.
  6. Home assistant should be updated incrementally for longer running fades. E.g. I have a 10 minute wake-up fade setup. Note: this incremental updating looks pretty cool in the color wheel in home assistant since it traces out the path from 1 color to another.
@Breina
Copy link
Owner

Breina commented Oct 4, 2023

Thanks for taking the time to point out issues and fix them on your repo! :)

  1. Agreed
  2. Agreed
  3. Agreed
  4. Agreed and I've been stuck on this for quite a while. I have been trying to implement something similar more than once. There's fixtures that have different behaviour between certain ranges, so the perfect solution would include sub-channel control (Switch on DMX channel ? #30). I'm cautious for implementing configuration changes, as we will only want to update them once. I've also tried using a setup from the GUI, but that gets a bit bloated.
  5. When we have RDM (Enhancement: Remote Device Management (RDM) #24), we can have better ID's. Maybe the name would be better than the channel. Changing unique ID's caused weeks of issues for many people as it involves deleting the old ones etc. So I am wary doing that again.
  6. Agreed

I'd like to implement 1, 2, 3 and 6 as you have solved them. Would you like me to merge them in, or would you prefer to create PR's (so that you become a contributor)?

I will work in 4 and 5 at the next major refactor, when that's mature.

@klopyrev
Copy link
Author

klopyrev commented Oct 4, 2023

Feel free to incorporate some of my design into your code. I'm happy to review changes once you have them.

@Breina Breina added the enhancement New feature or request label Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants