Hubitat Room Lighting with Linptech Presence Sensor

by

in

Introduction

I have talked a lot about how much I like presence sensors. I think it is also pretty clear that I like Hubitat Elevation and its advanced automation capabilities. In this article I will show you how I have set up my room lighting for a complete no-touch lighting automation.

This automation features:

  • Brightness variations by mode
  • Rapid responsiveness
  • Adaptive lighting based on illuminance
  • Hands-free lighting

Prerequisites

For this tutorial you must have:

  1. A Hubitat Elevation hub – any model
  2. Linptech or Moes Zigbee Presence Sensor connected to Hubitat
  3. Light bulbs or a switch connected to Hubitat. I am using Philips Hue bulbs.

Step-By-Step Instructions

Install the Linptech custom driver

There is a built-in driver for Linptech presence sensors. However, it lacks some of the functionality that will be required for this automation. Instead, I recommend this custom community driver by Gassgs. Thanks to kkosev and the Hubitat community as well.

Installing the driver is easy. Copy this URL:

https://raw.githubusercontent.com/Gassgs/Hubitat-Apps-and-Drivers/master/Drivers/Linptech%2024Ghz%20Presence%20Sensor%20ES1.groovy

Go to you Hubitat Dashboard > Drivers Code (you may need to expand the Developer tools section) > + New Driver > Import and paste the URL above in the box.

Assign the custom driver and configure your device

From the device page in Hubitat change the Type to “Linptech 24Ghz Presence Sensor ES1”

Click on Save Device. When the page reloads you can change the default configurations to fit your needs. I have mine configured for:

  • Detection Distance: 6 (this is in meters)
  • Fade Time: 30 (this is in seconds)
  • Motion Sensitivity: medium-high
  • Static Sensitivity: medium-high
  • Lux Threshold: 20
  • All other preferences toggled OFF

Create the Room Lighting Automation

Go to you Apps menu in Hubitat and install the built-in Room Lighting app if you do not already have it. Open the Room Lighting app and create a new automation.

Select the Room or Devices to automate. If you have your devices configured in a room, it will automatically select the devices, create some activation rules, and name the automation. You can update the name as desired.

If you have multiple bulbs then I also recommend setting a name for an activator device. The activator device can control all of the bulbs as a group and will be useful if you have a voice assistant or manually turn on the lights using Hubitat.

The page should now look something like this:

Configure/Modify the Room Lighting Automation

Lighting Periods

This section will leverage Modes to adjust the light brightness. If you do not have a dimmable light, then you can skip this section. You can configure your modes however you want. There is a built-in Mode Manager app that will allow you to change the mode based on factors such as time of day. I recommend creating these modes under Settings > Modes:

  • Daytime
  • Evening
  • Morning
  • Night

In your Room Lighting automation click on the “Set Up Lighting Periods or Re-Capture Devices”

Change the dropdown to Hub Modes, then select all of the modes. I have my modes configured like so:

  • Day: The lights are set to 90% brightness. I can’t tell much difference between 90% and 100%.
  • Evening. The lights are set to 60%. I find this is a good transition setting before going to sleep.
  • Morning: The lights are at 40% because I do not need much light in the morning
  • Night: Only a single light will turn on, and at minimum brightness. This is usually enough to move around without tripping, but also not be blinded in the middle of the night.

You can adjust the lighting and modes however you want. When you are done click Done with Periods at the bottom of the page.

Means to Activate Lights

Next, we will create the rules that will trigger activation of the lights. From the Room Lighting automation, click on “Means to Activate Lights.” If you used a room to add the lights and presence sensor then there should be two means already. If not, then you can add them now:

  • Motion becomes active
  • Illuminance falls

If you are using a switch, then also add a means to activate when the switch turns On. This will set the lights to the proper brightness if you manually turn on the light. There will be a case where this could be needed later.

Go ahead and select the devices for these options as well if needed. For the “Lux level to turn on at” you may need to adjust the value based on where your device is located. My sensor is pointed toward a window, so it tends to read pretty bright. I set it to turn on at 150.

Now open the Activate Lights Options menu. We do not need the lights to turn on if the room is bright, or if there is no one present. Under Limit Activation Under these Conditions select:

  • Illuminance is above
  • Custom Attribute

You can also optionally configure the light to turn off when the mode changes – to Night for example.

Select the presence sensor and set the luminance about 30 higher than the means to activate. I find I have different preferences for when the natural light is increasing or decreasing. This creates a buffer to account for those preferences.

For the Custom Attribute device, select your presence sensor, select the motion attribute, and choose the inactive value. This means the light will not turn on if motion is inactive.

Under Other Activation Options I use the indicator for if Any are on. This setting only affects when the automation will show if it is active or not. I also set the Additional Options to:

  • Adjust Lights on Mode changes
  • Activate even if already partially Activated (probably not needed)
  • Activate as Group with On command for Activator On (only available if you created an activator device previously)

I like to have the Device transition time to 3 seconds. I find it hurts my eyes less when the lights turn on a little slower, and it seems to help the light start at a dimmer level if the light was previously at a high brightness.

When finished, click Done with Activation Options, then Done with Means to Activate.

Means to Turn Off Lights

The last thing we need to do is configure when the light should turn off. Open the Means to Turn Off Lights menu.

You may have the All Motions stays inactive option already selected. The problem with this trigger is that it has a minimum setting of 1 minute, which is in addition to the fade time configured on the device. Presence sensors are sensitive enough that they do not need extra time. Remove this option if present and select these options instead:

  • Any Motion inactive
  • Illuminance rises

Select your presence sensor for both, and set the lux level to about 50 higher than the value to turn on. This gives it a buffer in case of natural light fluctuations, so your light does not turn on and off constantly if illuminance is near the threshold.

Open the Turn Off Lights Options. The only option I enable in this menu is the toggle for Turn Off even if already partially off. You can now click Done with Turn Off Options, then Done with Means to Turn Off.

Prevent the light from turning on in the middle of the night

When you’re ready to go to sleep you probably don’t want the light on. Because presence sensors are so sensitive, they know you are in the room even if you are not moving. To prevent the light from coming on at night you could limit activation when in night mode or set the lights to be off when the automation is active; however, neither of these solutions will turn the light on at the correct brightness when you need it. Instead, I recommend reducing the sensitivity of the presence sensor. For that, you will need the custom driver we installed at the beginning of this article, and Rule Machine.

Create an Automation to Reduce Presence Sensor Sensitivity

From the App menu install the Rule Machine app if you do not have it already. Open the app and create a new rule. Name your rule.

In the Trigger Events select Mode and *Changed*. We will create the automation so it will turn down the sensitivity at night and turn it back up in the morning.

Next we need to Select Actions to Run. Open the menu and click the Plus icon to Create New Action.

Choose Conditional Actions and If Expression Then. Define the expression element with -> New Condition.

The capability of the action condition should be Mode. Set the mode to Night.

Click Done and then Done again.

Add a New Action > Set Variable, Mode or File, Run Custom Action > Run Custom Action > Illuminance > Select the device > setDetectionDistance > string > 0.75

0.75 meters is the lowest allowed detection distance. It will only activate the device is you pass right in front of it. Any lower will automatically set the value to 0, which will completely disable activation. You can do that if you want. You can also use a higher number if needed. The goal is for the sensor to only see you when you get out of bed.

Repeat the custom action steps using setStaticSensitivity and setMotionSensitivity. I am still experimenting with these values, but right now I have them set to ‘low’ and ‘medium-low’ respectively. The allowed options for each are:

  • low
  • medium-low
  • medium
  • medium-high
  • high

We need the sensitivity to go back to normal during the other modes, so click Else and add the same custom actions, except using higher sensitivity values. When you are done, click on End-If.

You can now click on Done with Actions and then Done to install the rule.

Alternative Configurations

I have a couple of alternative setups for different situations in my home. I’ve added screenshots of one of the configurations below.

This one uses a switch instead of bulbs. I use the switch as an activator option so that the level gets set correctly if the light is turned on by something other than the motion sensor (mostly only used at night).

I use the time of day and the switch on/off to determine the sensitivity of the presence sensor. The idea is that the user will turn off the light at night when they are ready to go to sleep. They do have to turn the light on manually in the morning or walk close to the sensor to turn the sensitivity back up.

Conclusion

Congratulations, you now have an advanced lighting automation! You may need to fine-tune the lux levels and modes to suit your preferences, but you won’t need to touch the light switch or even issue a voice command to get perfect lighting any time of the day.

Please share in the comments below if you find this automation useful. Also let us know if you made any modifications.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *