PennazSoftware / homebridge-dmxlight-plugin

Homebridge plugin for controlling lights via DMX
Apache License 2.0
5 stars 2 forks source link

"fadeTime" parameter? #4

Open jlg89 opened 1 year ago

jlg89 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

jlg89 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Excellent! Would you mind checking something for me when you get it running? I’ve never been happy with the color accuracy (you choose pure red but it gives you something like a light-red at times for example) so I spent some time debugging it and my code and HomeKit seem to be sending the right color codes so I think it might have to do with my lighting controller. So I’m curious if you are seeing this behavior as well.

-Dan

On Feb 23, 2023, at 10:58 PM, jlg89 @.***> wrote:



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.

— Reply to this email directly, view it on GitHubhttps://github.com/PennazSoftware/homebridge-dmxlight-plugin/issues/4#issuecomment-1442887519, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALGYIL4FCX7FSQO3GFQA7VDWZBL2FANCNFSM6AAAAAAUZVXFFM. You are receiving this because you commented.Message ID: @.***>

jlg89 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

jlg89 commented 1 year ago
{
    "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 commented 1 year ago

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

jlg89 commented 1 year ago

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

jlg89 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

I’ve rewritten the transition from scratch and my tests last night looked very smooth. Also found a bug that limited the number of devices that could be used if they had different IP addresses. I’d like to conduct some more testing this weekend and then have something published by Sunday night PST (I’m in Seattle).

-Dan

On Jul 17, 2023, at 9:11 AM, jlg89 @.***> wrote:



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.?

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?

— Reply to this email directly, view it on GitHubhttps://github.com/PennazSoftware/homebridge-dmxlight-plugin/issues/4#issuecomment-1638450097, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALGYIL64MSTMKYLDDSYAAQDXQVPZRANCNFSM6AAAAAAUZVXFFM. You are receiving this because you commented.Message ID: @.***>

PennazSoftware commented 1 year ago

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

jlg89 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Thanks for the info. I’ll look into it this weekend.

-Dan

On Jul 29, 2023, at 12:13 PM, jlg89 @.***> wrote:



I removed the transitionEffect and transitionDuration from everything and tried it that way. Still did t work. 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?

— Reply to this email directly, view it on GitHubhttps://github.com/PennazSoftware/homebridge-dmxlight-plugin/issues/4#issuecomment-1656841608, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALGYIL5VFUIVCUPOWQWG7X3XSVOHFANCNFSM6AAAAAAUZVXFFM. You are receiving this because you commented.Message ID: @.***>

PennazSoftware commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

FWIW there's a lot of overlap here with https://github.com/PennazSoftware/homebridge-dmxlight-plugin/issues/7

jlg89 commented 1 year ago

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 commented 1 year ago

I’ve added the w option to sacn but there are issues with it that I believe relate to the sacn buffer for the universe. This gave me an idea. Do you have the ability to change your lights to each be on a different universe? That might solve the problem.

-Dan

On Aug 8, 2023, at 1:43 PM, jlg89 @.***> wrote:



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.

— Reply to this email directly, view it on GitHubhttps://github.com/PennazSoftware/homebridge-dmxlight-plugin/issues/4#issuecomment-1670282103, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALGYIL4TCGMZHHJTCJM3Z5LXUKQIVANCNFSM6AAAAAAUZVXFFM. You are receiving this because you commented.Message ID: @.***>

jlg89 commented 1 year ago

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 commented 1 year ago

Makes sense, it was just a thought. I’ll continue to investigate a solution.

-Dan

On Aug 9, 2023, at 6:11 AM, jlg89 @.***> wrote:



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.

— Reply to this email directly, view it on GitHubhttps://github.com/PennazSoftware/homebridge-dmxlight-plugin/issues/4#issuecomment-1671302004, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALGYIL7GAGCAA36Y7ADOGDLXUOEBNANCNFSM6AAAAAAUZVXFFM. You are receiving this because you commented.Message ID: @.***>

jlg89 commented 1 year ago

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:

  1. new vs. cached RGB values for the fixture
  2. transition setting for the fixture
  3. channel count for the fixture