Introduction:
The Smart Light Dimmer can turn on or dim a light variably, based on the value of a light sensor.
Turn your lights on gradually when the sun goes down? Turn on your desk lamp when the office gets too dark, or turn lights off when there is enough light available. It’s all possible.
!! ATTENTION !!
There are 2 versions: a simple version that simply controls the light’s brightness (up to version 2.0) and a more complex version that also controls temperature and color (version 2.1 and above).
Choose your version depending on your needs.
How it works:
Set maximum and minimum ambient light values between which the automation will run. The light will vary brightness between the settings at maximum and minimum light value based on the sensor reading.
When the ambient light goes over the maximum value, the light will be turned off, when it goes below, there is no change.
Example 1:
- Max ambient: 400 (± sunset value)
- Min ambient: 0 (nighttime)
- Light value at max ambient: 0
- Light value at min ambient: 255
→ The above example will start slowly turning up the light until full brightness when the ambient value drops from 400 to 0 (sunset to night).
Example 2:
- Max ambient: 400
- Min ambient: 50
- Light value at max ambient: 191
- Light value at min ambient: 107
→ This is how I use it in my office space.
It will turn on the light at 191/255 (~70%) when the ambient light drops under 400lx (for example when it’s cloudy outside during the day, or when the sun starts to set) and will actually dim the light down to 107/255 (~40%) around late sunset-nighttime so that there is not too much light, which might cause eye fatigue.
In this example, it will not dim further down than the set value at min ambient, even when the light value drops lower.
Credits:
- This blueprint is based on the math of @nickrout in this post: Dim lights as lumens increases
- Second credit goes to Nick’s math teacher at 14.
- @123 for greatly simplifying the code for the day condition
- Added color and temperature settings based on issues detected by @headless
Changelog:
10/01/2023 - Version 3.0( NEWEST - BETA)
- BREAKING: Added feature to set light values when going over and under max and min measured light values.
Please download the newest version and recreate the automations if you experience issues.
09/01/2023 - Version 2.1 ( NEWEST - STABLE)
- BREAKING: Added color and temperature settings for the light. These are fixed values and are not affected when the light changes brightness values.
Please download the newest version and recreate the automations if you experience issues.
28/03/2022 - Version 2.0 → !! LAST SIMPLE VERSION !!
This is the last version that simply dims the light between the minimum and maximum brightness values. Future version will add more complexity such as color and temperature changes. If you don’t need this, I suggest using this version.
-
BREAKING: Updated brightness values to percentages to improve user experience.
This version is not compatible with older ones. If you experience issues, please download the latest release and recreate the automations.
22/03/2022 - Version 1.3
- Simplified the code for the day condition
22/03/2022 - Version 1.2
-
BREAKING: Added day condition support.
Please download the newest version and recreate the automations if you experience issues.
21/03/2022 - Version 1.1
-
BREAKING: Added start & stop time conditions
Please download the newest version and recreate the automations if you experience issues. - Added versioning
- Added source url
19/03/2021 - Version 1.0
- Original release
Code: (Latest version)