Activate/Deactivate Motion Sensors based upon Outside Ambient Light Lux



I have been using SmartThings for the past two years and I wanted to programmatically deactivate certain motion sensors based upon the ambient light being sufficient to light a room 1) using existing motion sensors, 2) without the need to purchase new light detection sensors for each room, 3) without using CoRE; 4) all the while still allowing me to override the automation for any or all rooms when needed.

How it should work:

If it gets too cloudy outside in the middle of the day, turn motion sensors on.
When the sun comes back out, turn the motion sensors off.
Aways use motion sensors when the sun is low in the sky (regardless of clouds).
Always use motion sensors at night.
Optionally, control the motion sensors (on/off) using a virtual switch.


  • The outside ambient light provides a good approximation of when the inside room(s) need extra lighting. For example: when it gets too cloudy in the middle of the day, the living room is too dark, and the lights will turn on, but only when motion is detected. When the sun comes back out, the motion sensors turn off again.

  • The 15-minute refresh rate of the SmartWeather Station Tile device type (that is built-into SmartThings) provides the end-user sufficient granularity for outside LUX levels to trigger when room lighting is activated with motion.

  • The end-user already has existing motion sensors without light sensor capabilities and does not wish to purchase new equipment.

  • The end-user wants the flexibility of overriding the automation for any or all rooms, at any time, using a virtual switch for that room.


1. Install the SmartWeather Station Tile, enter your zip code in the settings. The LUX levels will update every 15 minutes, and will only be approximations according to the following:

10000 lux = clear, sunny
7500 lux = party cloudy, hazy
2500 lux = mostly cloudy
1000 lux = cloudy, fog, rain, sleet, snow
200 lux = thunderstorm

2. Create a Virtual Switch for each room having motion sensors. Call the switches [Room Name Motion Sensor]. You will use these switches to condition all of your current motion lighting automation in the Smart Lighting app. Go into each of your current automations, and add the condition ‘Only if switch’ [Room Name Motion Sensor] is ON.

3. Create a single Virtual Switch called [Brightest Midday Hours]. The position of this switch is necessary for the automation to determine when the motion sensors will turn OFF/ON (using LUX) and turn back on (regardless of LUX levels). This switch is controlled in the Smart Lighting app based upon sunrise/sunset, plus or minus X minutes (which can be changed based upon each location’s need). I have my conditions set to trigger [Brightest Midday Hours] at 120 minutes after sunrise (ON), and 120 minutes before sunset (OFF). LUX levels in the SmartWeather Station app are approximations, so using LUX levels alone (in my case) is not a good approximation of the need for inside light immediately after sunrise or immediately before sunset. In my example; two hours before sunset, when the sun is too low in the sky to provide sufficient light to a room, the motion sensors turn on (regardless of LUX), and two hours after sunrise the motion sensors turn off/on (depending on LUX).

NOTE: I first attempted using the sunrise/sunset settings in the Smart Lighting app to control the virtual [Motion Sensor] switches themselves, but you will need to base those lighting automations on LUX levels instead of time in order to trigger updates as changes in LUX occur due to weather conditions in the middle of the day. You will trigger your virtual motion sensors turning on/off with LUX changes based upon this [Brightest Midday Hours] virtual switch being in the ‘Only if switch is ON’ setting.

4. In the Smart Lighting app, create the following automations:

Brightest Midday Hours Controller (Turn On switch [Brightest Midday Hours] at sunrise +120, turn off at sunset -120)

Motion Sensor Controller 1 (Turn Off <virtual motion sensor switch(es) and corresponding lights> when switch [Brightest Midday Hours] turns ON and illuminance is equal or higher than 7500 lux).

Motion Sensor Controller 2 (Turn Off <virtual motion sensor switch(es) and corresponding lights> when illuminance is equal or higher than 7500 lux when switch [Brightest Midday Hours] is ON).

Motion Sensor Controller 3 (Turn On <virtual motion sensor switch(es)> when switch [Brightest Midday Hours] turns OFF.

Motion Sensor Controller 4 (Turn On <virtual motion sensor switch(es)> when illuminance is equal or lower than 2500 lux when switch [Brightest Midday Hours] is ON).

(Eric) #2

IMO your method is better daylighting compensation than relying on the typically inaccurate/irrelevant physical lux sensors built-in to some motion sensors. And the switch benefits the user by being easy to observe and override. I am eagerly awaiting the next eclipse to see what happens.

You said "…LUX… will always be at their highest (10000 lux) on a clear day, regardless of of the sun’s position in the sky, until the sun officially sets. "

This is not exactly my experience, which is that the reported approximate lux ramps down in steps on the way to sunset.


Thanks for that point @ero4444. I checked my logs from last night, and it appears the LUX started ramping down on a clear evening about one hour before sunset; Sunset -76 minutes (10000 lux), -46 minutes (7757 lux), -31 minutes (5257 lux), -16 minutes (2757 lux), -1 minute (257 lux), +14 minutes (10 lux). Nice catch.

This may be sufficient that some users would want to adjust the Sunset offsets for the [Brightest Midday Hours] automation according to their specific needs, or not use the offsets at all.