I've recently made some additional modifications to my adaptation of Mat's FastDMX plugin.
The main trick to this is that a system variable (dmxHexVals in my case) holds a long string of 2 character hex values separated by spaces that are the DMX control string. This allows a channel to be changed without affecting the other channels.
My latest mods added the ability to work readily with Indigo Control Pages. I've added a number of system variables for each channel of DMX that I'm using. The following are examples of the variables: (I use the same channel, C49, for all of the examples)
C49 - The 2 digit hex code for the level of channel 49 is stored here. A trigger is created and set to call varToSerial anytime the variable changes.
C49Default - The default level to set the light to.
C49Status - The status of the channel - false for 0 and true for any value from 01 to FF.
Other required system variables are one for the last channel to have been changed, lastChannelChanged in my case, and one for the last value that channel was set to, in my case lastChannelChangedValue. (Yeah, the names are long, but I learned the hardware many years ago that if the variable name is very clear, your less likely to accidentally use the wrong variable. :-}
My current versions now has the following methods in it:
hexToSerial - This was my original method where a DMX channel and a 2 character hex value are passed in the call. it sets the value in the appropriate location in the system variable dmxHexVals. It use to then send that variable to my DMX controller but now is just updates dmxHexVals.
Values passed: Channel, e.g. C49, level value, e.g. C0 (75%)
varToSerial - This method is triggered by the value of one of the channel variable, e.g. C49 changing. The channel is passed by the trigger and the method pulls the value for the channel from that variable. It then sets the appropriate 2 hex digits into dmxHexVals, updates the channel status variable, and the lastChannelChanged system variable as well as the lastChannelChangedValue.
Value passed: Channel, e.g. C49
toggleStatus - This method will get the status value, e.g. C49Status and the default value. e.g. C49Default. If the status is true, it sets the channel value,. e.g. C49 to 00. If the status is false it sets the the channel value to the default value, e.g. 80 (50%).
Value passed: Channel, e.g. C49
incDec - This method is passed U or D (although anything other than U is counted as D), and the value to increment or decrement. I set a default value of 10 (hex) in the dialog setting up the call to give me 16 steps of level control but that can be overridden. The method gets the lastChannelChanged and the lastChannelChangedValue. I set an offset of half the value of the amount to increment as I don't like going to full on (little additional light for a lot more power used). If the incDec value passed was U, I add the amount to increment/decrement to it plus the offset calculated. to the current value for the channel (in C49). If that is greater than FF, I change the value to 100 less the offset. If incDec wasn't passed a U, I subtract the value to decrement from the current value of the channel and if it is now less than 0, I set it to 0. I then update the value of the channel that last changed and update the value lastChangedChannelValue.
With the above changes I was able to easily make a control page using the PowerButton image with it set to reflect the status of the channel it controlled. Pressing the button calls toggleStatus and either turns the light off or turns it on to the default level. That button indicates that status by turning red or green automatically, and it works pretty much instantaneously.
I was also able to put up and down buttons separated by the variable values for the channel number and the level of the channel. Pushing the up bottom calls the incDec method passing a U. I think you can figure out what the down buttons does.
While I have 3 separate pages for each of the major areas of my house, I also made one with all 43 lights on one large page with a single set of up/down buttons along with 3 fans and some Insteon controlled lights and devices.
If anyone would like to check it out, please send me a personal message with your email address and I'll send the plugin to you. There is limited error checking at this point, but the hexToSerial has been working for about 2 years now without any problems. The latest updates have been working well for the last couple of weeks.
One inherent problem with this sort of system is that multiple people using it at the same time are bound to run into Insteon issues from overlapping commands. I haven't run into it very much other than when I push multiple buttons on an 8 button controller to fast. But I'm single, and while I've had people visit and stay for a week or more, I haven't heard of them having any problems. And believe me, my brother can break just about any system!!!
LewK
P.S. I've tried to correct any typos in the above, but I've been staring at the screen for two long and my eyes are starting to go buggy. :
So if there are errors, I'll have to correct them later.