Manual turn off a light will it turn on again base on the code?


#1

1) Give a description of the problem
Let’s say I have code to turn on a light between sunset to 11:00PM. If current time is 10:00PM, the light should be on. If I manually turn off the light from an app, will it be turned on again by the logic from the code?

2) What is the expected behavior?
I guess if I manual turn it off, it should not be turned on again. It should be turned on the next cycle so it should be turned on the next day after sunset. Right?

3) What is happening/not happening?
I am not sure what is happening now. It seems like it does not turn on after I turn it off manually unless I hit test from the code.

Thank you very much. Sorry about it since it may be a stupid or too general question.


#2

Your observations are correct. If you manually override the bulb, it will not correct itself until the piston runs again. (either by hitting TEST or one of the two times rolls around)

There is an exception to this case. (well not really an exception, but an addendum)
If there is another line of code in that piston with a trigger, that trigger will ALSO run thru the entire code, hereby, ‘fixing’ your light once again.


#3

Thank you for the answer! So I think that means

The time between sunset to 11:00PM doesn’t mean it always check the condition between this time frame, instead of it only checks the condition when it’s sunset then check the condition again when it’s 11:00PM. Do I understand it correctly?

If my code involves a trigger, that means anytime a trigger is triggered, the logic is processed. Let’s say a logic base on a trigger changes to on. When I manually switch it off, the trigger will run to see if it’s changed to on or off then the corresponding logic will be run. Right?

Thank you again!


#4

“I am not sure what is happening now. It seems like it does not turn on after I turn it off manually unless I hit test from the code.”

You could try turning off command optimisation so that whatever state webCoRE thinks the switch is in, it will always send the command.
In edit mode, click on the piston name.
In the window that opens, click on the settings cog and turn off command optimisation.


#5

That’s helpful! WebCore is really smart and powerful!

Thank you very much.