If no colour specified when light turned on, turn on warm white during night and cool white during day


#1

Hi there I want all my lights’ default colour temperature to be warm white during the evening/ night and cool white during the day.

So if i turn a light on and don’t at the same time specify a colour or temperature (as some of my scenes do) i want smartthings to automatically set it to warm white between 12 midday and 6am and cool white between 6.01 am and 11.59am.

I don’t want this to impact the smooth running of my scenes or routines which DO specify a colour or temp (in those cases the specified temp or colour should always be used)

Can anyone help?


#2

IF
light’s switch changes to ON
AND
age([device name : color]) is greater than 5000
THEN
If time is between x and y
set color to warm
Else
Set color to cool


#3

How about something like this.

IF
Light x changes to ON.

THEN
IF
Time is between 12:00 and 06:00
WITH
Light
DO
Turn On
Set Colour to warm white

IF
Time is between 06:00 and 12:00
WITH
Light
DO
Turn On
Set Colour to cool white

I’m assuming your set you colours and scenes through the day when the light is already on.


#4

Hi thanks for your quick reply,
.
That won’t work, as I mentioned, I need something which doesn’t interfere with scenes I have that have set coloUrs.

Ie. I have a scene called wind down which I use every night which turns on and changes the light to red. Doing as you describe could interfere and cause the light to turn to white


#5

Hi thanks for your quick reply,

Can I ask what the ‘age’ and 5000 represents ?
.
I need something which doesn’t interfere with scenes I have that have set coloUrs.

Ie. I have a scene called wind down which I use every night which turns on and changes the light to red. I don’t want my new piston to interfere and cause the light to turn to white when I run it


#6

The age function returns the amount of time since the named attribute (in my example color) last changed, in milliseconds.

The 5000 is 5 seconds (in milliseconds)

So

IF light changes to On
AND
color hasn’t changed for 5 seconds
Do stuff


#7

Just thinking and might be worth adding a wait, as there might be a race condition with other pistons otherwise.

IF
light’s switch changes to ON
THEN
wait 5 seconds
IF
age([device name : color]) is greater than 5000
THEN
IF
Time is between x and y
set color to warm
Else
Set color to cool
end if
end if
end if


#8

Thanks. I’m just not sure if that will work as it my scene takes a while to turn the light red as do some other automations


#9

How long is a ‘while’?

Are you referring to ST’s built in scenes
? Coz they don’t have waits or delays, 5 seconds from turning on should be enough of a safety net?

If you’re referring to webCoRE pistons that intentionally delay changing the color, you might need to setup a global variable to pause the warm / cool piston.


#10

Yes. I thought of that which is why I said that your scenes run when the light is already on.
If they do it should work as I have used ‘changes to on’. If lights are already on this piston will not run.


#11

I have both - a mix of webcore and smartthings ‘scenes’ and routines.


#12

Hi BobSorry I may be missing something (forgive me)
My existing scene turns the light ON and sets to red. I run the scene by voice commanding my google home.SO, looking at what you propose.IF
Light x changes to ON. (this would apply to when my scene runs and turns the light on).THEN
IF
Time is between 12:00 and 06:00
WITH
Light
DO
Turn On
Set Colour to warm white

This would interfere with my scene as it sets the light to red and this would then turn it to whiteIF
Time is between 06:00 and 12:00
WITH
Light
DO
Turn On
Set Colour to cool white

This would interfere with my scene as it sets the light to red and this would then turn it to white

I want this core piston to not interfere with any colours prescribed in
my scenes or routines, and only use these warm and cool settings for
different times of the day if the light is not set to a particular
colour or temp when it is turned on.


#13

Hi Robin

Thanks.

My only prob with this, is that i think it might mean that my light turns on initially at the colour it was last set to.

So for example, the preceeding evening i may have used my scene which turns the light to red.

SO the next day if i run this piston, and it turns the light on and waits 5 seconds (or however long) i will then get on at red light, followed by switch to white light


#14

It will be a bit messy yes… maybe leave the routine actions blank and let webCoRE do the job… not sure if this will work but worth trying… you’ll still get a slight flash of the old color though.

IF
routine X executes
THEN

set to red

ELSE

IF
light’s switch changes to ON
THEN
IF
Time is between x and y
set color to warm
Else
Set color to cool