I’m working on a virtual dimmer that controls one rail of a Hunter Douglas TDBU shade. A dimmer seems like the way to go for these, as you can actually get the current state of a shade through the HD gateway (via RS232 or TCP…I am doing the latter).
I have it working. But had coded up the code to write the required commands to the gateway as a function, and when I called that function passing the newLoadlevelTarget as a parameter from the SetLoadLevelTarget action, the Lua engine would complain about trying to do math on a nil object (or something akin to that). When I instead had the action set a plug-in local variable before calling the function with no parameter, and had the function use that variable as its input, I got different errors about trying to do math on an uplevel object…again, roughly.
In the interest of doing something else this weekend (need to bring the irrigation up), I sucked the 16 lines of code required to do the work into the action inline, and that works fine. But the software engineer in me is puzzled how one is supposed to pass parameters into functions from actions in some way that works.
–Richard