Now that you understand the last example now you can start testing for dimmer levels. Say want to run a scene only if a dimmer light is between 10 to 20% and its dark out. I will use my device 25 for this example.
– Find the current dimmer level
local Light1State= luup.variable_get(“urn:upnp-org:serviceId:Dimming1”, “LoadLevelStatus”, 25)
– Run this scene only if the light is dimmed between 10-20%
if (tonumber(Light1State) >= 10) and (tonumber(Light1State) <= 20) and ( luup.is_night() ) then
return true – run the scene because the light is between 10-20% and it is dark out
else
return false – exit the scene without running it because the light is not between 10-20% or it is not dark out.
end
Note that you can change the dimmer value from a string to a number with “tonumber”, (tonumber(Light1State) >= 10) before you test values. In this case greater than or equal to 10. or you can use this:
if ((Light1State) >= “10”) and ((Light1State) <= “20”) and ( luup.is_night() ) then
They both should work. I like to use “tonumber” since I can use math to easily change the value.
Is this same level of control possible using the hardware (Jasco) dimmer switches? I would like to set the brightness level of each switch depending the time of day.
Hi I’m new with this, I have a dimmer that I want to set to 20% just if it is turned of. I put this code in the Luup section of the Scene but, first don’t know exactly how to get the device number. Is it the ID or the # in the Setting part of the Device?
if (luup.is_night()) then
local familyDimm = luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", 2)
if (tonumber(familyDimm) == 0) then
return true
end
else
return false
end
Thanks Garret,
Then it was ok, but still it doesn’t work.
I did a Reheal, and notice that the dimmer has 2 starts.
What basic troubleshooting can I do? Someone send me an URL to get the logs of the veralite, but not sure how to read it.
I saw there is a luup log function, if I print the value of the dimmer, will I see it there?
What other trouble shoot can you recommend me?
Experiment, you asked the same question on another thread and I answered it there.
(Double-posting of questions is considered antisocial, particularly because it pollutes the ability for others to search the forum for questions already answered.)
Sorry Futzle,
I’m getting used to this. I should open a new thread. I didn’t realized how active is this forum. I just was impatient.
By the way, thank for the answer in the other thread. I think it was the problem.