hallo.
My problem is that i don’t have a lux meter so i cant tell micasaverde only aktivate light if lus meter is under or over %
I have 3 motion detectors controlling light in the house right now. boot the light is aktivatet all day long even if ther is light i that room (ofcours only if there’s motion) so a waste of electricity.
How can i tell micasaverde to only activate lights i a time fram… like 6pm to 8am next morning så if there is motion from 8.1 am to 5.59 pm the light whont go on?
only way i could get the motion detectors to work was to asioate the motien detecter and plug together.
If you put this code in the LUUP section of your scene the light will only switch on between sunset and sunrise:
if (luup.is_night()) then
return true
else
return false
end
ok one way of doing it but i wont my light som times to go on before sunrise. Is there any way of controlling the motion detectors in a time fram? by my licking
OK then, how about using the virtual switch plug-in? You could schedule that to turn on and off at particular times, then check it in the scene which operates your lights.
if i do dat will my light only be turned on in the time freme i set? oncurs only if the motien detectors is aktivatet by my going past? not interested in my lights being turned on all the time?
Yes, it would do what you want. The scene trigger would be the motion detector but the LUUP code would check the switch status and prevent the scene from switching on the lights if the virtual switch was off.
can someone explain my how to get it to work. i hafe trade many times bot it isint working
-
Create a scene to turn on the light when a sensor is tripped.
-
Add this code in the Luup code section:
local sensorDeviceNo = 16 – Motion Sensor device number
local lightDeviceNo = 13 – Light device number
local period = 10 – Seconds
local SS_SID = “urn:micasaverde-com:serviceId:SecuritySensor1” – Security Sensor Service ID
local SP_SID = “urn:upnp-org:serviceId:SwitchPower1” – Switch Power Service ID
function checkLastTrip()
local lastTrip = luup.variable_get (SS_SID, “LastTrip”, sensorDeviceNo) or os.time()
if (os.difftime (os.time(), tonumber (lastTrip)) >= period) then
luup.call_action (SP_SID, “SetTarget”, {[“newTargetValue”] = 0}, lightDeviceNo) – Turn off the light.
else
luup.call_delay (“checkLastTrip”, period) – Check when the sensor was last tripped every seconds.
end
end
luup.call_delay (“checkLastTrip”, period)
return true
Why not follow the link provided by oTi@ and use the code in the section entitled “Scene that runs only in a user set time interval”?
thanks for the link very helpful
the problem is that my sencer isnt working properly what i want it to do is turn on in a set time for x amount of seconds and then turn off
right now i have set the sencer to activate when theres is movement and then deactivate one minute later i did that by creating a scene with the sencor as the trigger and then i created a time delay of one minute only issue is its not based on looacode its only done by the interface that means that the sencer goes off one minute after activation even if theres movement and then reactivates again instead of resetting the timer within the minute thats what i was trying to accomplish with the piece of code mentioned above but i couldnt get that code to work was wondering if anyone could give me a step by step walk through to do this and then how to time set it would be the next goal any help would be appreciated
help please!!!
This countdown timer might do what you need:
Also, what is the brand/model of your motion sensor?
If possible, I’d let the sensor do the timing. I think typically there is some configurable interval, either as a configuration parameter through Vera, or some switch on the device itself with a few presets.
As an example, assume you can configure the interval to be “10 minutes”.
- When the sensor sees motion, it will tell Vera. You can create a scene to turn on the light, based on the event [tt]An armed sensor is tripped[/tt] + [tt]Device armed is tripped[/tt].
- When the sensor hasn’t seen motion for 10 minutes, it will tell Vera. You can create a second scene to turn off the light, based on the event [tt]An armed sensor is tripped[/tt] + [tt]Device armed is not tripped[/tt].
The light should now be controlled by motion. If that works, add Luup code to the first scene that will restrict when the scene to turn the light on runs (see the wiki page).
I have not tested this.