Odd behavior with CoRE, when clauses, and location mode


(Rainer Kraft) #1

I have a CoRE like this:

if activity sensor A changes to active
when true
Using (Light A and Light B)
Turn On (only for Home or Away)
Using Light A
Turn On (only for Night Mode)

I want to turn on both lights during the day and only one light during the night.
What happens is that
Light A turns on at night
Light B turns on during the day

Is this by design? Does Light A not turn on during the day since it’s listed in both actions and the Night Mode comes last so it’s ignored or overridden by the second action?


( I hate Mondays) #2

On the second Using set TOS to None. It’s overriding the first…


(Rainer Kraft) #3

Thanks. Now I’m trying it with a if … else if … end if block but now both lights always go on. It always uses both actions now (both lights are on, one with 100% and one with 1%)

So I guess I didn’t understand these if/else if/end if blocks correctly.

How would I write this then? What I want to do is:

if motion and dark outside and any of the two lights are off then
if night then
turn on one light with level set to 1
if not night then
turn on both lights with level set to 100
endif
if no motion and any of the two lights are on then
turn off lights
endif

I know I could write
if motion and … and night then

endif
if motion and … and not night then

endif
if no motion … then

endif

But then I have to write the motion group twice which I want to avoid.

It looks like the if then else if then else will not do it since the last else is of the second if and not the first if

if then else will not do it since I cannot get another if into the then case


(Rainer Kraft) #4

This one seems to work. I couldn’t use just an else block instead of the else if block. It would just not go into the else case, even if the if block was not true. Strange. Maybe a bug?