Hi kigmatzomat.
Thanks for you help and inspiration.
The first script worked like a charm, the second one have a bug in it that took me a while to figure out
(at least in the current UI7)
Let me explain.
You are getting the current light level in this line
local lightLevel =luup.variable_get(“urn:upnp-org:serviceId:Dimming1”, “LoadLevelTarget”, device)
Now you lightLevel var contain a string with the value of, lets say “10”
Later on you are making a comparison like this while (lightLevel <100) do
This will not work because you are comparing a string with a number.
The reason it works anyway is because you have lightLevel =lightLevel+1 and that is a number (1 the first time)
The way to fix that is to convert it to a number like this
local lightLevel =luup.variable_get(“urn:upnp-org:serviceId:Dimming1”, “LoadLevelTarget”, device)
lightLevel = tonumber(lightLevel)
And now for my contribution. This script will increase the light level to 20%,40%,60%,80%, 100% and then turn the light off for each time you run the scene.
If the light level is 10% it will increase it to 20%, if its 21% it will increase it to 40% etc.
It works in conjunction with the Wallmote
local device=15 --to be replaced by the id of your bulb
local switchOnOff = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, device)
local lightLevel =luup.variable_get(“urn:upnp-org:serviceId:Dimming1”, “LoadLevelTarget”, device)
lightLevel = tonumber(lightLevel)
if (lightLevel<20) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “20”}, device)
elseif ((lightLevel>=20) and (lightLevel<40)) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “40”}, device)
elseif ((lightLevel>=40) and (lightLevel<60)) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “60”}, device)
elseif ((lightLevel>=60) and (lightLevel<80)) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “80”}, device)
elseif ((lightLevel>=80) and (lightLevel<100)) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “100”}, device)
elseif (lightLevel==100) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “0”}, device)
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=“0” },device)
end
There might be a better way to do it, but it works 
Best regards,
Jens