Is there anyway in a scene to dim a light by a percentage? I.e. -10% on each scene call
You would have to do it in LUA OR PLEG
You need to access the current value and do the appropriate math (% of full delta, or % of the current value change) and then use that value to dim the light.
Got it. Does PLEG work with UI7?
Yes
Here is a LUUP snippet of code that I use to Dim a light by steps, that that I can dim my lights from the TV remote. I also use PLEG but this was one function that I have yet to port to PLEG yet. But I think the LUUP code would be similar:
Where 96 is the device ID of your switch.And I step up by 10 ramp steps per time the scene is executed. You also need to make sure you don’t go over 100 or less than 0, or you may get weird results ![]()
ocal light_dstat_t = “0”
local light_dstat_n = 0
local light_main = 96
light_dstat_t = luup.variable_get(“urn:upnp-org:serviceId:Dimming1”, “LoadLevelStatus”, light_main)
light_dstat_n = (tonumber(light_dstat_t) + 10)
if light_dstat_n < 100 then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = light_dstat_n}, light_main)
else
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “100”}, light_main)
end
Awesome! Thanks so much!