Hi All
Could anybody help me set up a conditional trigger scene that turns a light on when my front door sensor is tripped AND it is after sunset?
Many Thanks as ever!
Hi All
Could anybody help me set up a conditional trigger scene that turns a light on when my front door sensor is tripped AND it is after sunset?
Many Thanks as ever!
You should find what you need in Conditional Scene Execution.
Cheers Rex - looking now
Or you can use Combination switch with smart switch plugin , or PLEG , but PLEG is more complex
Best thing about Smart Switch that you get the option to make the light turn off after xx time , so it’s so easy and handy
Hi
Not sure if you got this sorted or not but I’ve just been working on something similar, if you tweak the code it should work
Have a 4-1 sensor and a dimmer in the hallway, I wanted to be lazy
and have the light come on for me once i walked into the hallway but only if the light was off and there wasn’t enough light for me to see
So what I did was created a new scene and added a trigger, the trigger was when the PIR was tripped. Once this was setup i added the Luup code
[i]local device = 33
local sensor = 27
local lightlevel = luup.variable_get(“urn:upnp-org:serviceId:Dimming1”,“LoadLevelTarget”, device)
local sensorlevel = luup.variable_get(“urn:micasaverde-com:serviceId:LightSensor1”,“CurrentLevel”, sensor)
lightlevel = tonumber(lightlevel)
sensorlevel = tonumber(sensorlevel)
function switch_off()
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “0”}, device)
end
if (lightlevel == 0) and (sensorlevel <= 20) then
if (luup.is_night()) then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “30”}, device)
luup.call_delay( ‘switch_off’, 60)
else
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “80”}, device)
luup.call_delay( ‘switch_off’, 60)
end
end[/i]
As you can see with the first IF command, if dimmer is at 0 and the light level is below 20% then run the next command, this is then saying IF night dimm light to 30% else set to 80%. Also added the delay function so the light stays on for 60 seconds
the main code is in there, just need to tweak and remove a few lines
Hope that helped
Thanks
Best Home Automation shopping experience. Shop at Ezlo!
© 2026 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules