[quote=“tamorgen, post:26, topic:197000”]Does anybody know what luua code you would need to use to address the parameters directly? I’ve been trying to implement a slow ramp up to turn on my lights to 50% using PLEG. The best I’ve come up with so far is pretty kludgy. What I’ve done thus far, is set the light level, do a 5 second delay, set the light level agin, do a 5 second delay, etc, until the light level gets up to where I want it.
The one thing I noticed from PLEG is that the parameters seem to be named differently than described in this post
I’ve attached a screenshot of what PLEG shows for the device.
I want to set Parameter 7 and 8 on the fly. I’m just not sure of the format.
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “50”}, 173)
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “?”, ? “?”}, 173) <------ For Parameter 7
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “?”, ? “?”}, 173) <------ For Parameter 8
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=“1” },173)
Or do I need to do something else?[/quote]
So, I figured out the problem.
First off, unless variable 6 is changed back to default, it doesn’t need to be changed once set. In reality, the same goes for variables 7 and 8 for setting the ramp rate, but in my case I want to set different ramp rates for different conditions. I discovered the problem was in the wording for variable 7. It says you can have from 1 to 99 steps. It turns out, the larger the number the fewer steps it takes to get to your desired target. So, if you choose 99, thinking that that is the maximum number of steps to use, it’s backwards. 99 steps will get you to your target the fastest. Choosing 1 step will get you there the slowest. In the example below, I choose 15 for fairly slow, but fast enough that it doesn’t take forever to get there. The 255 entry is as expected, as it’s 255 (x 10) ms between steps, so 2.5s
To ramp up:
luup.variable_set( "urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesSet", "7,1d,15", 173 )
luup.variable_set( "urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesSet", "8,1d,255", 173 )
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },173 )
return true
To turn off the lights, I set a faster ramp rate of 25. It’s still fairly slow, but not quite as slow.
To ramp down:
luup.variable_set( "urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesSet", "7,1d,25", 173 )
luup.variable_set( "urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesSet", "8,1d,255", 173 )
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },173 )
return true
The nice thing in all this is even with my recessed LED bulbs, I really don’t notice the ramping up or down of the lights. It’s not as jarring as before when I had just set delays and set the light a specific level.
Regarding the format after VariablesSet, the first is the variable, the second is the number of decimals, and the third is the value you want to set. The last value, after the quotes, is the device number.
According to both Z-wave Alliaance and Jasco, the length for both 7 and 8 is 1 BYTE. 1 Byte is from 0 to 255, or 00000000 to 11111111 in binary, or 2[sup]8[/sup]. Where I think there is some confusion, is the parameters can be 1d, 2d or 4d in luup. If you look at Device Options and the pull down (see attached screenshot), it says 1 byte dec, 1 byte hex, 2 byte dec, 2 byte hex, etc. The abbrevited parameter of luup makes one believe that it’s 1 dec, meaning singles, tens, hundreds, etc, when in fact it’s looking for X bytes dec or X bytes hex.
2d would actually be 16 bits, or 0000000000000000 to 1111111111111111,or 2[sup]16[/sup], (0 to 65535), which is way beyond the accepted value.
So, bottom line, you need to use 1d for these parameters, which is 1 byte dec, which covers 0 to 255.