Dim with steps

Hey, is there anyway to create a scene in vera light that every time it runs dims ex 10% up or down?

First run: +10% = 10%
Second run: +10% = 20%
Third run: +10% = 30%
etc…

Skickat fr?n min GT-I9295 med Tapatalk 4

Hi,

There is an app in the app store called wake up light or wake up ramp. that does what you want. I never found one that dimmed the lights (e.g worked the same as the app but in reverse) so for this I use Luup Code.

I am no expert but this worked for me:

[code]local delay = 5 – change this for your “delay” between chnages

luup.call_delay( ‘Light_75’, delay )

function Light_75()
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “75”}, )
luup.call_delay( ‘Light_50’, delay )
end

function Light_50()
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “50”}, )
luup.call_delay( ‘Light_25’, delay )
end

function Light_25()
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “25”}, )
luup.call_delay( ‘Light_00’, delay )
end

function Light_00()
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “00”}, )
end[/code]

add more functions and commands as needed to make the set up you want - for a long transition that is smooth you need lots of functions sadly. there will likely be a far better way of doing this but this worked for me so I just stopped when it worked.

Hope this helps.

What i can read from your LUUP it will ligthen the lamp automatic with specific interval on light level.

I want to do this with a push of a button or a command in my android phone.

for example 1 push = 10%.
And if i only press once it will only be 10% until i turn it of or change it.
If i press one more time the light will increase with 10% again and so on.

If you put the following Lua in your scene it will increase the dimmer level by 10% each time it runs - until it reaches 100%.

local dID = <ID of your dimmer> local level = tonumber(luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",dID),10) if level < 100 then if level <= 90 then level = level + 10 else level = 100 end local args = {} args["newLoadlevelTarget"] = level luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", args, dID) end

there seme to be something wrong with that code. Vera keeps saying " Error: Error in Lua for scenes and event"

Is there somwhere else i should change than after device ID.
My device has ID 2

Just in case anyone else stumbles across this post I thought I would share. I was looking for a better way to dim down and dim up my lights in irule since the irule vera module sucks so bad. Rex’s code works perfect although there was a slight typo (D was lower case in dID) and adjusted it slightly to allow to dim down as well.

Dim up

local dID = <ID of your dimmer> local level = tonumber(luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",dID),10) if level < 100 then if level <= 90 then level = level + 10 else level = 100 end local args = {} args["newLoadlevelTarget"] = level luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", args, dID) end

Dim down

local dID = <ID of your dimmer> local level = tonumber(luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",dID),10) if level > 0 then if level >= 10 then level = level - 10 else level = 0 end local args = {} args["newLoadlevelTarget"] = level luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", args, dID) end

Thanks Rex