ELSE IF / done the right way?


1) Give a description of the problem
New at ST and webcore !
Problem is that i cant test at the moment… So while waiting for the new router i thought i might make some test files to fire when it arrives…

2) What is the expected behaviour?
Having lights in the hall between my bedroom and toilet. Want some of the light to just light the hall up in daytime or when there is light in the bedroom. When no light in bedroom i dont want the light in the hall to be as bright so instead it should fire a LED strip thats hidden and give en indirect light …

3) What is happening/not happening?
IS the stop the right way to end an else if


I did not dig into your piston. But I did notice that you have nested triggers, lines 33 and 45. Generally, triggers should be top level with conditions below. Having nested triggers may not function as you anticipate.


If you are using trigger conditions (e.g. changes to) you ideally need them to run whenever that trigger condition may have occurred. So in your case, if a Motion Sensor 1 motion event occurs, you want both triggers to run. That won’t always happen - if the if group is true the else if group isn’t evaluated. The reason it can be a problem is that a ‘change’ is evaluated by the trigger condition itself by comparing the current event value to what it was the last time it saw it, and if it never saw the inactive state, it won’t know about the active.

As @Pantheon suggests, it is best to avoid nesting triggers, and also to avoid inadvertently preventing them be evaluated by having them inside only when blocks or as the second condition in an and or or.

It may be in practice there isn’t a problem, but it is worth avoiding.

The stays condition is also classed as a trigger and the same comments largely apply. The more pressing issue you have is that in order to get to line 45, the stays inactive trigger, the motion must have just changed to active.


Okay router up n running … so testing can be done live :slight_smile:
And yes, first attempt was a no go -as stated in the tread.

This seems to work - but how to do kill the light after a period of time ?