Confusion regarding dim levels (getting vs setting)
Posted: Friday 21 February 2014 22:27
I'm just starting out with some Lua scripting for Domoticz...
On thing I would like to do is an event that when a PIR triggers, I want to set a specific dimmer to 100 percent, and when the PIR is no longer active, I want to change the dimmer back to whatever state it was before (usally around 40 percent or off). My idea is a script that when the PIR triggers, write the dimmers state to a text file and then set the dimmer to 100 percent, and when the PIR changes state again, read the previous value from the text file and set it back to that.
However, it seems that when you get the svalues for the device, the dim levels are in 16 steps, from 0-15, but when you set the dim level, you are suposed to set it as a percentage value (0-100)? This seems a little confusing to me... or is there another way to get/set these values?
On thing I would like to do is an event that when a PIR triggers, I want to set a specific dimmer to 100 percent, and when the PIR is no longer active, I want to change the dimmer back to whatever state it was before (usally around 40 percent or off). My idea is a script that when the PIR triggers, write the dimmers state to a text file and then set the dimmer to 100 percent, and when the PIR changes state again, read the previous value from the text file and set it back to that.
However, it seems that when you get the svalues for the device, the dim levels are in 16 steps, from 0-15, but when you set the dim level, you are suposed to set it as a percentage value (0-100)? This seems a little confusing to me... or is there another way to get/set these values?