Configuring Lights to Turn On/Off with Motion Sensor - Depending on Light Level

Alrighty,

So I have an HSM100 - and I can’t seem to get it work the way I want. I’m sure it’s me, not the sensor.

It is added to Vera (UI4) fine. I am getting temp and light sensors a plenty, and I can get it to turn on the lights in the room when is senses motion.

Here is where I am stuck;

I want it to use the light level to know whether or not to turn on the light. For example, it turns on the light regardless if it’s noon (and the room is full of sunlight) or midnight with no light. How can I make it use a certain light percentage reading from the sensor? So that the room has to only have 10% light, THEN the light comes on with motion?

Second challenge - I want the lights to go off after 10 minutes of no motion …

Any help would be GREAT - as I’ve been playing with this for a while and can’t seem to get it to work for me.

Add this code to the LUUP tab in the scene that you created:

local lul_light_level=luup.variable_get(“urn:micasaverde-com:serviceId:LightSensor1”,“CurrentLevel”,32)

if ( tonumber (lul_light_level) >10) then
return false
end

In the first line of the script, change the “32” to the ID of your light sensor
In the second line of the script, change the “10” to whatever light level you want as the threshold.

FYI, I added this script after seeing a post in the forum from another member. Oddly, it did not work correctly for a couple of days and I opened a ticket with MCV. As soon as I got a response from MCV to offer to work the issue, the script began working correctly. Prior to that, the brightness threshold was ignored and the lights would be triggered regardless of the brightness reported by the sensor.

Great, I will try this. Quick question; do I have to
Add events to this scene too? Or will the script be it?

Hi MotoElement,

In your dashboard click on the little spanner (Wrench) which is on the right hand side of your sensor box.

Then click on the Device Options tab, then in Variable Setting 4, under Desired Value, add the Light Setting you want.

I’ve got mine set to 10 which makes it quite dark before my sensor starts to get tripped.

I’m assuming that you are using Vera 2 and UI4

Hope this helps

Begging for some more code snippets. After turning light on…

How do you:

  1. Turn light off after 10 minutes (no matter what)

  2. Turn light off after 10 minutes of no motion.

I don’t mess around with the code stuff. I set the device parameters to get the functionality I need. I just go to the device’s Settings tab and the Custom Device Settings button and add parameter variables for light sensitivity, on time, and motion sensitivity.

http://www.expresscontrols.com/pdf/EZMotionOwnerManual.pdf

As I understand it, there are two (at least) schools of thought. You can have sensor control the devices, or you can have a scene control the devices. If you want the device to be involved in more than one operation, you need to create a scene for each series of events. If you have only one operation for the device, you can accomplish it by having the motion sensor send on and off commands. In a perfect world, I think having the actions controlled by a scene is more flexible, but also is more difficult.

I handled the on/off control by creating one scene which turns on certain lights when motion is detected AND if the light level is low. I created a second scene which turns the lights off when it gets the ‘no motion’ report from the motion sensor. It’s probably not the most eloquent solution, but it seems to be quite reliable. I left the “on time” at the default of 20 minutes, but that can be changed.

I noticed that when adding the commands to turn on the lights with the scene, there is an option with the command tab to turn the light off after a period of time. This actually might be a better way in case you want the different lights to turn off at different intervals.

[quote=“m0jon, post:4, topic:166533”]Hi MotoElement,

In your dashboard click on the little spanner (Wrench) which is on the right hand side of your sensor box.

Then click on the Device Options tab, then in Variable Setting 4, under Desired Value, add the Light Setting you want.

I’ve got mine set to 10 which makes it quite dark before my sensor starts to get tripped.

I’m assuming that you are using Vera 2 and UI4

Hope this helps[/quote]

Thanks. I am using a Vera 2 and UI4. So when I when I chance the variable setting that just means that the light sensor will trip the sensor and turn on the lights regardless of whether or not motion is detecetd - correct?

I am looking to make it work so that it needs to detect motion AND the light value be less than 10 to trip the light.

Any thoughts?

Hi MotoElement,

Changing the variable to “10” will NOT mean the the light goes on at low light levels. It will only switch the light on with LOW Light and Movement.

Great, so what “Data Size” so I use?

1 byte dec and be patient. It can take some time before the settings are updated in the sensor, so you can see the current setting in Vera.

I too use the internal light level parameter for these kinds of things, and I must say it works great. It just took a little patience and experimentation to determine the appropriate light level for each application, but it has been solid for me since I got it dialed.

The other option (via luup code as the snipit above illustrated) can also work, but unless you need more advanced logic (say, only turn on/off if it is below a certain light level and before 11pm, on a Tuesday :slight_smile: ), I’d just use the internal parameter option.

Cheers

[quote=“m0jon, post:4, topic:166533”]Hi MotoElement,

In your dashboard click on the little spanner (Wrench) which is on the right hand side of your sensor box.

Then click on the Device Options tab, then in Variable Setting 4, under Desired Value, add the Light Setting you want.

I’ve got mine set to 10 which makes it quite dark before my sensor starts to get tripped.

I’m assuming that you are using Vera 2 and UI4

Hope this helps[/quote]

Also - which device am I doing this on? Obviously it shows up as a 3-in so I have a separate device for motion, one for light, and one for temp. Do I set the variable “4” on the light one?

On the HSM100 device - with the battery icon.

Ahh - gotcha thanks. I’ve updated the sensor and now it’s just waiting for wakeup. I’ll check it in the morning to see if I got the settings right. Thanks to all!

So here is what my setting look like - look right??

My driveway HSM100 is set like this: (see JPEG attached)
parameter 2 (ON time) 3 - re-activates motion sensing after 3 minutes
Parameter 4 (light threshold) 20 - doesn’t come on unless it’s almost dark
parameter 1 (sensitivity) 40 - cats and cars driving by don’t trigger it

Skip the parameters you don’t want to change from standard. In your case just the variable 2 and 4 otherwise the device might possible get confused otherwise. From your screenshot there is not yet any info on current value and that means that the device is not using your new settings(yet).

How long should it take the setting to take effect? I changed them last night at 10p, it’s now 5p here?

Also - how do you skip them? I don’t see an “X”

Thanks for all the help! Much appreciated!

There should be and x right side below current value. It is on mine.
If the device don’t update try to move the sensor to Vera and go into settings, click “poll now” and then push the blue button on the device(in this order). The sensor is belived to have some problems in setup if it is to far from Vera.

If you don’t get the “x”, you might try to remove the device and reinstall it and keep the device close to Vera when doing this.