Jump to content

How to setup automated brightness changes by time of day with manual override and Alexa integration


Recommended Posts

Posted (edited)

The goal of this is to show how to create a lighting scene that changes brightness throughout the day using an Insteon 6-Button controller (2334-2) and a FanLinc responder (2475F). Also, I will cover how to create an override function to bring the lights to 100% brightness with the 6-Button controller and also how to properly integrate this with Alexa while maintaining full voice control of ON / OFF and brightness level. i.e. Alexa lights 50%.

Insteon Configuration:

We will be using adjust scene to accomplish to majority of this task. It's important to recognize that adjust scene will not transfer properties to any scene / controller not explicitly programmed.

In this example the following scene and device names will be used.

Scene Name: Guest Ceiling Lights

Devices in scene: Guest FanLinc Fan-Light(2475F Responder & GuestRm KPD6.1 Fan Light (2334-2 Controller
  
 

guestgroupfull.thumb.jpg.27b8d849442d0a8a5b04245bef1faf9e.jpg

We now need to create four programs and one integer variable. The integer variable will be used to keep the value of the last used brightness state in case the manual override is used and we wish to return to the previous brightness level.

Integer Variable Name: i.Guest.Ceiling.Light.Current (Init = 0)

Let's look at the four programs we will need for this example. You could easily add additional programs for addition times of day.

Programs and Functions

Guest Light Ctrl Day – Controls the light brightness for day time

Guest Light Ctrl Day - [ID 0044][Parent 0006]

If
        Time is Sunrise + 20 minutes and 15 seconds
 
Then
        $i.Guest.Ceiling.Light.Current  = 100
        In 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' To 100% in 0.1 seconds, No retries
        In 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' Set 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' To 100% in 0.1 seconds
        In 'Guest Room / Guest Ceiling Lights / Guest Ceiling Lights' Set 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' To 100% in 0.1 seconds
        In 'Guest Room / Guest Ceiling Lights / Guest Ceiling Lights' Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' To 100% in 0.1 seconds
        Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' On Level 100%
 
Else
   - No Actions - (To add one, press 'Action')

Guest Light Ctrl Evening – Controls the light brightness for evening

Guest Light Ctrl Evening - [ID 0045][Parent 0006]

If
        Time is Sunset  - 30 minutes and 15 seconds
 
Then
        $i.Guest.Ceiling.Light.Current  = 40
        In 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' To 40% in 0.1 seconds, No retries
        In 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' Set 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' To 40% in 0.1 seconds
        In 'Guest Room / Guest Ceiling Lights / Guest Ceiling Lights' Set 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' To 40% in 0.1 seconds
        In 'Guest Room / Guest Ceiling Lights / Guest Ceiling Lights' Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' To 40% in 0.1 seconds
        Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' On Level 40%
 
Else
   - No Actions - (To add one, press 'Action')

Guest Light Manual Override 100% - Controls the brightness level for manual override of current setting (Default to 100%)

Guest Light Manual Override 100% - [ID 003D][Parent 0006]

If
        'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' is switched Fast On
    And 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' is not switched Off
    And 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' is not switched Fast Off
 
Then
        In 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' To 100% in 0.1 seconds, No retries
        In 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' Set 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' To 100% in 0.1 seconds
        In 'Guest Room / Guest Ceiling Lights / Guest Ceiling Lights' Set 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' To 100% in 0.1 seconds
        In 'Guest Room / Guest Ceiling Lights / Guest Ceiling Lights' Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' To 100% in 0.1 seconds
        Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' On Level 100%
 
Else
   - No Actions - (To add one, press 'Action')

Guest Light 6-Button On-OFF (Return to previous Level) – Controls On-Off of the light to the desired lighting brightness as defined by the Ctrl Day, Ctrl Evening and Manual Override.

Guest Light 6-Button On-OFF (Return to Previous Level) - [ID 003E][Parent 0006]

If
        'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' is switched On
    And 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' is not switched Off
    And 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' is not switched Fast Off
 
Then
        In 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' To '$i.Guest.Ceiling.Light.Current %' in 0.1 seconds, No retries
        In 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' Set 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' To 100% in 0.1 seconds
        In 'Guest Room / Guest Ceiling Lights / Guest Ceiling Lights' Set 'Guest Room / Guest 6-Button KeyPad / GuestRm KPD6.1 Fan Light' To '$i.Guest.Ceiling.Light.Current %' in 0.1 seconds
        In 'Guest Room / Guest Ceiling Lights / Guest Ceiling Lights' Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' To '$i.Guest.Ceiling.Light.Current %' in 0.1 seconds
        Set 'Guest Room / Guest Ceiling Fan / Guest FanLinc Fan-Light' On Level '$i.Guest.Ceiling.Light.Current %'
 
Else
   - No Actions - (To add one, press 'Action')


In each of these programs adjust scene is used to control all aspects of the Guest Ceiling Lights scene. If you look carefully at the THEN section of each program you will see that all possible combinations of scene, controller, and set has to be explicitly handled in your program. No properties will be inherited in adjust scene. So if in adjust scene you set the scene and controller both as the scene and assume because you selected the scene in both cases that all devices in the scene will inherit the properties; you are mistaken. The desired changes will not be inherited by the other devices in the scene and must be explicitly programmed individually. You need to explicitly create an adjust scene for each and every possible combination of scene / controller / set.

Adjust Scene Programing:

Lets look at the Guest Light Ctrl Day program in more detail and go over the adjust scene line by line.

The first THEN line sets our integer variable value so that we can return to the previous brightness level with a single button push if the manual override is used.

In the second line of the THEN we find the first adjust scene statement. Notice it is for the following combination of scene / controller / set.

Guest Ceiling Lights (The scene) / GuestRm KPD6.1 Fan Light (Controller) / Guest FanLinc Fan-Light (The device being set)

2023-04-15_14-25-08.thumb.jpg.9d596cf58dc694461b39d596b972fb7e.jpg

Remember I said every possible combination of scene / controller / set needs to be explicitly programmed? Here are program lines 3-5 of the above example in more detail. Take careful notice of how the set configuration parameter THEN line three in adjust scene has changed to the GuestRm KPD6.1 Fan Light, from the above program THEN line three which set it to Guest FanLinc Fan-Light. I'll cover program THEN Line Six towards the end.

THEN Line Three:

2023-04-15_14-33-43.jpg.ded07408c095e0f53bd9d8e9cadc51f6.jpg

THEN Line Four: In the previous adjust scene program commands (lines 2-3) we were changing the controller KPD6 6-Button KeyPad. Now we need to change the Guest Ceiling Lights scene itself and both devices in that scene. Pay attention to how the controller changes from GuestRm KPD6.1 Fan Light to the scene Guest Ceiling Lights in the second line of the adjust scene dialog box labeled Controller.

2023-04-15_14-38-18.jpg.d67b1e1d0bbc530569647e099fed6384.jpg
 

THEN Line five:

2023-04-15_14-41-54.jpg.c4c5989ddad28802c0313e2648e224e8.jpg

The one remaining change (Program THEN line six) that needs to happen is for the FanLinc ON LEVEL to be set, since the FanLinc is a responder in the scene there is no way using adjust scene to change it's ON LEVEL value without explicitly programming that value outside of adjust scene.

2023-04-15_14-51-22.jpg.fcc9ca7f7c20d02f0647435c04da1ac5.jpg

That takes care of the adjust scene for a two device scene. If you have more devices in the scene you will need to add additional adjust scene program lines to accommodate the additional devices.

If you were paying attention to the above programs you noticed that the Guest Light Manual Override 100% program uses FAST ON (double tap) as it's trigger. You could change this to what ever you prefer. The programming I have shown allows for a double tap to change the lights to 100% brightness and then a single press sets them back to their previous brightness level. The OFF button turns the lights off.


Alexa Integration:
By using adjust scene we have also enabled Alexa voice control to turn on the lights to their pre-programmed day / evening brightness levels by simply saying, "Alexa Guest Lights ON". So during the day they are at 100% but in the evening they change to 40%.

But what if the lights are at 40% brightness and you want them at 100% without going to the 6-Button controller or maybe 20%. The secret here is to setup the Alexa integration to the FanLinc (2475F) device as a LIGHT and not to the Guest Light scene.

2023-04-15_15-04-31.jpg.4bbbf01df966261582b92173028aefee.jpg


Now you can tell Alexa to turn the light ON /OFF and any number to set the brightness level. i.e. "Alexa lights 25" This would turn on the Guest lights on at 25% brightness or change the brightness to 25% from what every level they are at.

I hope someone finds this helpful.

 

Edited by kzboray
  • Like 3
Posted

Well done! I bring the warm white and cool white colours into play with mine. Since I use all WiFi lighting I use no Insteon scenes, only my own software written scenes.
I have also found with small increments I can dim groups of lights at different times so the dimming is not very noticeable>

As a side note when I first created my first method based on the system number of minutes left in each day until midnight, I noticed an expected but unexpected phenomenon. Before my dimming programs and during the pandemic, I, and my wife and S-I-L were frequenting bed about midnight to 1:30 AM. After running the programs for a few months 10-11 PM became a very common time for bedtime. The colour changes and gradual dimming did seem to modify our circadian rhythms.

  • Like 1
  • 3 months later...
Posted

krakra - do us something with photoreceptor input

when a storm comes through, it gets dark enough to run my sunset program - but its triggered by time only

maybe i can find a z-wave device with a p/r - weather sites would probably not be accurate enough

all the nerdz here said they would shower you with money and admiration if you can do it for us

 

Guest
This topic is now closed to further replies.

×
×
  • Create New...