I want to Put on the light for 30 second when Outisde light <80 Lux and Security sensor is tripped
So I create a scene with this lua code, but nothing append…
So I need your help (it’s my first scene with lua and activating a device)
Is this code correct ? And how schould I build my scene ?
local luxgrenier = luup.variable_get(“urn:micasaverde-com:serviceId:LightSensor1”,“CurrentLevel”,39)
local tripped_bedroom = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Tripped”, 42)
local allow = true
return (((tripped_bedroom == “1”) and (luxgrenier < “80”)) == allow)
when you select your triggers there is a button that looks like an L this opens the widow above, any code here is run before other scene lua code, and actions last, if the code returns false the scene will stop. http://wiki.micasaverde.com/index.php/Luup_Scenes_Events
Try using the sensor tripped as the trigger for your scene, and then put only the test for lux < 80 in the Scene Lua. The Lua code of a scene is only executed when the scene triggers.
Thanks to all, now with your help, everything for fine. And yes Allow is a part of code i found on this forum. I will also have a look on Reactor which seems to be an intrestting plugin (even if I don’t want to be to much depend on plugin…because with the time, plugin became obsolete if the author stop to update them… See my post about RGB plugin who didn’t work with new Fibaro without changes on the code)
And to finish, I really appreciate this forum as threre is lot of people who help to fight problem!
Reactor will not go obsolete as it does not depend on an external api or on some devices firmware. It’s one plugin that replaces the vera scenes, and is far better at handling luup reloads. You will not regret using it.