Lights Not Adjusting


#1

Hi all,
I recently discovered webCoRE and it’s great, except for one problem:

I want my lights to automatically dim if they are on late at night (between 10 PM and 2 AM).

The piston works if the lights are already turned on. However, if I turn a light on after 10 PM, nothing happens. According to the logs everything is running and in the SmartThings app, it shows that the piston changed the color temperature (though not the level) but the lights don’t actually change.

Does anyone know what I have wrong?

Thanks!


#2

Can you post a log from WebCore please?


#3

Here’s the log from yesterday. It “ran” at 9:59 PM but since the light was off, it didn’t do anything. When I turned the light on (around 11 PM), nothing happened and the light was on the default settings, not dimmed.

1/30/2018, 12:07:20 AM +828ms
+1ms ╔Received event [Bedroom Light 1].switch = off with a delay of 196ms
+104ms ║Runtime (37489 bytes) successfully initialized in 35ms (v0.2.102.20180116) (101ms)
+105ms ║╔Execution stage started
+143ms ║╚Execution stage complete. (38ms)
+144ms ║Setting up scheduled job for Tue, Jan 30 2018 @ 2:00:00 AM EST (in 6759.029s)
+154ms ╚Event processed successfully (154ms)

1/29/2018, 9:59:59 PM +115ms
+1ms ╔Received event [Home].time = 1517281200000 with a delay of -885ms
+107ms ║Runtime (37495 bytes) successfully initialized in 42ms (v0.2.102.20180116) (105ms)
+113ms ║╔Execution stage started
+208ms ║║Executed [Bedroom Light 1].setColorTemperature (18ms)
+215ms ║║Executed [Bedroom Light 2].setColorTemperature (5ms)
+232ms ║║Executed [Bedroom Light 1].setLevel (14ms)
+241ms ║║Executed [Bedroom Light 2].setLevel (7ms)
+244ms ║╚Execution stage complete. (136ms)
+246ms ║Setting up scheduled job for Tue, Jan 30 2018 @ 2:00:00 AM EST (in 14400.64s)
+252ms ╚Event processed successfully (252ms)

1/29/2018, 8:30:14 AM +999ms
+2ms ╔Received event [Bedroom Light 2].switch = on with a delay of 590ms
+10147ms ║Piston waited at a semaphore for 10022ms
+10149ms ║Runtime (37571 bytes) successfully initialized in 10074ms (v0.2.102.20180116) (10146ms)
+10150ms ║╔Execution stage started
+10184ms ║╚Execution stage complete. (34ms)
+10189ms ║Setting up scheduled job for Mon, Jan 29 2018 @ 10:00:00 PM EST (in 48574.813s)
+10198ms ╚Event processed successfully (10198ms)


#4

First, I think you need to set logging to Full to really see what’s going on. You’ll see full evaluation of the conditions.

Second, I think your bulbs only respond to set color & set level commands when they are on. Bulb 2 was turned on at 8:30pm, so the piston triggered at 10pm as it should and it set the color and level for both bulbs. Bulb 1 was off, so it ignored the command, but bulb 2 should have changed to these settings. When bulb 1 was turned on at 11pm, it didn’t change the condition of the piston - only 1 bulb needs to be on for it to fire, and nothing tells it to re-fire when the second bulb is switched on. Thus, bulb 1 switched on with whatever settings when it was last on. The only way to get this piston to change both bulbs is if they’re both already on at 10pm.

I think that if you set command optimization off it’ll force sending the commands to bulbs that are off. But I don’t know if your bulbs will take this as the setting that they should use when they are eventually turned on. That is, if either is off at 10pm.

Try changing line 20 to switch is changed to on.


#5

Thanks @jsducote. That works when I turn the lights on and off from the SmartThings app. However, if I turn them on using the manual light switch on the wall, the piston doesn’t run. Is there some other condition I could use that would cover that?


#6

Do you have smart bulbs or smart switches? What type of switch are we talking about that you have on the wall?

You could try this method too…I’m not sure if I perfectly understand what you’re trying to do…but this is my guess.


#7

Smart bulbs; the light switches are just regular, old-fashioned light switches.


#8

Hmm, yeah, you mentioned the ~11pm manual switch change. That’s why I wanted to see full logging, which should tell us why ST didn’t think it needed to re-execute the piston. But I think it’s because switch2 was already on, so it only needed to fire when the time condition changed, which it did even though it didn’t set color & level for the bulb that was off. Changing switch1 to on isn’t something that would cause it to re-execute.

Thus, try changing the statement ‘any of bulb1 or bulb2’s switch is on’ to ‘any of bulb1 or bulb2’s switch is on OR any of bulb1 or bulb2’s switch changes to on’. Keep the ‘time is between’ line as it is. That should cover both cases of a switch already being on as well as if the other switch turns on during the time boundaries. It should also allow you to turn one or both lights off after 10pm and turn them back on again before 2am and have it set the desired color & level. I think your current piston would require you to turn them both off before turning one on to have it set desired color & level. Make sense?


#9

Gotcha. I’ll try that. Thank you!