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

"fadeTime" parameter? #4

Open
jlg89 opened this issue Feb 13, 2023 · 29 comments
Open

"fadeTime" parameter? #4

jlg89 opened this issue Feb 13, 2023 · 29 comments
Labels
enhancement New feature or request

Comments

@jlg89
Copy link

jlg89 commented Feb 13, 2023

Is your feature request related to a problem? Please describe:
I want to use HomeKit scenes to control lighting presets in an auditorium. This works, but changes are instantaneous and jarring. I need a way to fade from current settings to new settings.

Describe the solution you'd like:
A "fadeTime" parameter, either global or per fixture, that tells the plugin how long to take to fade from current levels to new levels. As an example, in my application, I like to use a 10s fade.

Describe alternatives you've considered:
The only alternative is to use an actual hardware or software DMX controller that has a fade function.

@jlg89 jlg89 added the enhancement New feature or request label Feb 13, 2023
@jlg89
Copy link
Author

jlg89 commented Feb 13, 2023

It might also be nice to have a "keepAlive" parameter, that would make the plugin send the last-set DMX values once per second. This would help folks who have something like a Doug Fleenor Preset 10 wall panel, which controls the DMX fixtures with its own presets unless it detects another DMX control signal. The DMX spec says that 1s is the minimum timeout for detecting loss-of-signal.

@PennazSoftware
Copy link
Owner

FYI, I have been working on adding support for the fade as well as a couple of other transition effects.

@jlg89
Copy link
Author

jlg89 commented Feb 21, 2023

That's fantastic. The plugin works great (even with the Preset 10, I have found), I just need to be able to fade between settings. I'm willing to compensate you for your time, if that would be helpful. This is a really solid solution to the problem of multi-point DMX control, at least for relatively simple sequences. The "real" DMX controller apps on iOS seem to be single-point control, so you have to have a single dedicated iPad. This plugin gives you DMX control from anything that can run the Home app.

Also, FWIW, I'm using this with a Chauvet DMX-AN2 in sACN mode -- so you can add that to your supported hardware list.

@PennazSoftware
Copy link
Owner

I just released a new version and it is now available in HomeBridge. Note that there is a breaking change to the config file so you'll need to move your ipAddress into the config for each accessory. Consult the README for more information. There are three new lighting transitions...the one you want is called "gradient'.

I was not able to get to the KeepAlive request as its actually quite a bit more complicated than it appears and I don't have a lot of time right now.

@jlg89
Copy link
Author

jlg89 commented Feb 24, 2023

That's great news. I'll test & report. I don't think I need the keepAlive function as I initially thought, because it seems that the DMX-AN2, once I send a DMX command through it, maintains a live DMX signal thereafter. I don't see any activity light on the output, but the Fleenor module says it's there. SMH but it works. I've also configured the Fleenor to maintain the last-sent settings if & when it does take over, so it should be fine either way.

@PennazSoftware
Copy link
Owner

PennazSoftware commented Feb 24, 2023 via email

@jlg89
Copy link
Author

jlg89 commented Feb 26, 2023

I don't have any RGB lights, they're all just faders (both spots and LED cans).

The gradient mostly works, but it seems like it's not starting from last-set values. When I go from one preset to another, the lights either go full on or full off for a split-second, then jump back to something close to what they were before. I'll upload a video.

@PennazSoftware
Copy link
Owner

Interesting. The pop would seem to indicate the light wasn't fully on or else maybe it starts to fade and then ramps back up to full before fading again. I'll investigate on my end. Your video was super helpful.

@PennazSoftware
Copy link
Owner

I'm not able to reproduce the behavior you are seeing. Would you mind sending me your DMX Light Homebridge Config JSON?

@jlg89
Copy link
Author

jlg89 commented Mar 7, 2023

{
    "platform": "DMXLightHomebridgePlugin",
    "name": "DMX Light",
    "accessories": [
        {
            "name": "Left Spots 1",
            "id": "009",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 9,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "Left Spots 2",
            "id": "010",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 10,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "Pulpit Spots",
            "id": "011",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 11,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "Baptistery Spots",
            "id": "012",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 12,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "Right Spots 1",
            "id": "013",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 13,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "Right Spots 2",
            "id": "014",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 14,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "Cross Backlight",
            "id": "015",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 15,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "House C1",
            "id": "017",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 17,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "House C2",
            "id": "018",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 18,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "House C3",
            "id": "019",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 19,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "House C4",
            "id": "020",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 20,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "House Rear",
            "id": "021",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 21,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "House Windows",
            "id": "022",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 22,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "Stage Accent",
            "id": "023",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 23,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        },
        {
            "name": "Baptistery Ceiling",
            "id": "024",
            "driverName": "sacn",
            "ipAddress": "192.168.3.35",
            "dmxStartChannel": 24,
            "dmxChannelCount": 1,
            "dmxUniverse": 1,
            "colorOrder": "rgb",
            "transitionEffect": "gradient",
            "transitionDuration": 10000
        }
    ]
}

@jlg89
Copy link
Author

jlg89 commented Mar 8, 2023

Did another video, not sure it will help, but maybe.

@jlg89
Copy link
Author

jlg89 commented Mar 8, 2023

Here are the HomeKit scenes for the various presets in the video.

@jlg89
Copy link
Author

jlg89 commented Apr 7, 2023

Did another video, not sure it will help, but maybe.

Is there a way I can log the output of the plugin, so maybe we can try to figure out what's causing the "pop" at the beginning of transitions?

@jlg89
Copy link
Author

jlg89 commented Jul 17, 2023

Trying to figure out the best place to start. You and I probably have about the same amount of free time to dig into this stuff. :D

I’m looking at dmx.tx and trying to trace through the applyGradientTransition subroutine. Not a TS coder, though, so some of it is still Greek.

I see where you determine the number of discrete updates (colorPoints) that will need to be made in order to get from point A to point B, in line 198.

I see you’re passing colorPoints to the setMidpoint function. I guess that function returns an array of color values, one set for each value of colorPoints. Are the numbers in that array actual values, or are they values that must be added to the currentColorStr values? IOW if we’re going from 100 to 110 over ten update intervals, does the array contain 101,102,103 etc. or 1,2,3 etc.? How does it handle negative gradients?

Also, how long does the array in sacnUniverseMap survive? I assume it dies if the plugin instance is restarted, but does it have another timeout as well, or anything that would change/clear/zero its values other than the user calling for a new setting?

@PennazSoftware
Copy link
Owner

PennazSoftware commented Jul 22, 2023 via email

@PennazSoftware
Copy link
Owner

The change is now available. Please let me know how it works.
-Dan

@jlg89
Copy link
Author

jlg89 commented Jul 26, 2023

I'm still getting crazy light effects. Same config as above. It works perfectly if I drive it with the Photon app on iPad, so the hardware config checks out. The weird behavior doesn't make sense; let me know if there's a way I can log the output or something, whatever would be helpful for troubleshooting.

@jlg89
Copy link
Author

jlg89 commented Jul 27, 2023

Actually, looking at your code, there should be plenty of stuff in the debug log to give us some kind of clue...let me see what I can do with that.

@jlg89
Copy link
Author

jlg89 commented Jul 29, 2023

I removed the transitionEffect and transitionDuration from everything and tried it that way. Still did weird things, but not for any duration (since transition effects were disabled). So I tried controlling each fixture independently in HomeKit. When I adjust a fixture, that adjustment works, and the log file shows that adjustment being made -- but every other light turns off. Whichever light I adjust works, and the rest turn off.

So whatever sACN string is getting sent is telling everything else to go to zero. That bit isn't showing up in the log. Not sure what's going on here, other than maybe the plugin is either not storing or not reading the last-sent values for each fixture?

@PennazSoftware
Copy link
Owner

PennazSoftware commented Jul 29, 2023 via email

@PennazSoftware
Copy link
Owner

I think your configuration is a bit wonky. You have defined overlapping channels...so they are fighting over one another. Each RGB light consumes three channels (one for each color). The second accessory you have defined is starting at the GREEN channel of the first light and the third accessory is overwriting the BLUE channel of the first light. You're config should instead look more like the following:
"accessories": [
{
"name": "Left Spots 1",
"id": "009",
"driverName": "sacn",
"ipAddress": "192.168.3.35",
"dmxStartChannel": 9,
"dmxChannelCount": 3,
"dmxUniverse": 1,
"colorOrder": "rgb",
"transitionEffect": "gradient",
"transitionDuration": 10000
},
{
"name": "Left Spots 2",
"id": "010",
"driverName": "sacn",
"ipAddress": "192.168.3.35",
"dmxStartChannel": 12,
"dmxChannelCount": 3,
"dmxUniverse": 1,
"colorOrder": "rgb",
"transitionEffect": "gradient",
"transitionDuration": 10000
}...

Give that a try and let me know. BTW, I released another version today, however, it won't have any impact on what you are experiencing.

-Dan

@jlg89
Copy link
Author

jlg89 commented Jul 31, 2023

Ah, I see. Looking in the code, it looked (to the obviously untrained eye) like there was a check for the defined number of channels, and that it would just use the first color for a single-channel config. But I now notice that I can set the color order to "w" for a fader-only single channel. That loses gradients, though, correct?

Maybe a (relatively) easy way to support single-channel transitions would be to check for colorOrder being "w" and, if so, simply use the "r" value from the transition sequence and ignore the other two?

@jlg89
Copy link
Author

jlg89 commented Jul 31, 2023

Oh, wait...when I set the colorOrder to "w" I get this error for every fixture. This is with all the transition config removed, and running v1.2.5.

7/31/2023, 7:21:25 AMDMX Lighting BridgeDMX LightAn unsupported color order was found. Now using default of "rgb".
7/31/2023, 7:21:25 AMDMX Lighting BridgeDMX LightRestoring existing accessory from cache: House C1

@jlg89
Copy link
Author

jlg89 commented Jul 31, 2023

FWIW there's a lot of overlap here with #7

@jlg89
Copy link
Author

jlg89 commented Aug 8, 2023

Ah, it looks like the "w" colorOrder option only works with enttec, and I'm using sACN. All my lights are fader-only, so one channel each.

@PennazSoftware
Copy link
Owner

PennazSoftware commented Aug 9, 2023 via email

@jlg89
Copy link
Author

jlg89 commented Aug 9, 2023

The lights allow selection of their DMX address, but the universe seems to be dependent on the physical cabling. The DMX-AN2 interface supports two separate universes (ie it has two output connections). So the only way I could reconfigure would be to either re-address all the fixtures to put two empty channels between each one (so sending RGB to a fader-only fixture wouldn't affect the next fixture), or make clever use of a three-channel fixture in the plugin to control three single-channel fixtures with adjacent addresses, using each of the RGB values to set individual fader levels. Either method would completely break the existing control setup, and would be pretty non-intuitive for "the next guy" whoever that is.

@PennazSoftware
Copy link
Owner

PennazSoftware commented Aug 9, 2023 via email

@jlg89
Copy link
Author

jlg89 commented Aug 9, 2023

I'm trying to dig into the code enough to understand what it's doing and how, so it may be doing things this way already, but this is how it seems to me that the logic should work:

  • Because it is potentially receiving input from multiple Home apps, the plugin has to store a full set of "last sent" values for the entire DMX universe. It can probably get away with storing this in memory, but it might be better if it can be saved to disk so it survives a homebridge restart.
  • It probably has to send a full set of values for the entire universe at every update, to accommodate the "worst case" scenario among the various DMX interfaces. Maybe use some sort of boolean "sendUniverse" flag to trigger an update.
  • When a command comes in to change a value, the plugin checks:
  1. new vs. cached RGB values for the fixture
  2. transition setting for the fixture
  3. channel count for the fixture
  • If there's no transition setting, just update cached universe with the new values and send the full (updated) universe.
  • If the channel count is "1" for a fixture, only update the first value (which would be R by default) for that fixture in the cached universe, leave the other two values alone. This should eliminate the need for the "w" setting.
  • If there's a transition setting, calculate the needed transitional time-based steps between cached value and new value, run per-fixture loops to apply those steps to the cached universe.
  • Send the entire cached universe at regular intervals while any transition loop is active (maybe have each loop enable the "sendUniverse" flag).
  • If another command input comes in for a fixture already in a transition loop, recalculate the needed transitions based on current cached value and update the loop accordingly.

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