Automate Virtual Switch Too Off


#1

Help. This is my living room switch. How can I tell the living room switch to turn off if the back corner and front corner are off? I don’t want the switch staying on if those two lights turn off.


#2

I am thinking something like this:

IF ANY of Back Corner OR Front Corner CHANGES TO off
Then
    IF ALL of Back Corner AND Front Corner ARE off
    Then
    Turn off Living Room
    End If
End If

I realize this may look redundant, but it keeps the triggers tight and accurate.
The piston only runs at the precise moment either corner turns off.
If they are both off at that time, then it will turn off the Living Room.

(notice the slightly different wording in the two IF statements)


#3

Where in the Piston would I put that?


#4

Entirely on it’s own. Either in a new piston, or in a brand new block.
(just make sure you delete/disable/pause your old logic regarding this so there is no conflict)


#5

Thank you!!!


#6

That created a weird loop


#7

If you are having any loops, it is because you have old code still active.
(you must delete/disable/pause your old logic so there is no conflict)

This has been tested and works like a champ.

(Notice line 19 is the trigger, and line 23 is a condition)


#8

My issue is I changed my switch and figured that code would still work. When I turn the corner lights off it turns off the living room switch and then flips the corner lights back on with this code. I fixed it by pausing the piston, turning off living room and then resuming the piston. Its messy but works lol.


#9


#10

Ugg, I hate pausing pistons for brief moments. It definitely points towards sloppy code

I do not see this logic in any of your pistons above…


#11

Those are the only two pistons that are part of living room. Your code works on other switches I have upstairs just not on the living room dimmers.


#12

It’s almost like when it turns off the corner lights read the living room level and turn back on. The living room switch turns off like its supposed to but those flip back on.


#13

Turning off the living room should NOT turn on any lights… That code is nowhere visible to me…

But as long as you are happy, all is good


#14

Did you actually try my piston above using the import code? I double layered it to prevent extra commands from being sent.

When testing it, make sure you PAUSE your piston “Living Room Switch Off”


#15

Oh wait, I see what is happening!

You have levels in your first piston. The levels are remembered between sessions, so even if the Living Room is off, the level may still be 50%. You are basically forcing in a level across the two corner lights!


#16

How do I fix this? Lol


#17

You could resolve this my tweaking your top piston a bit into two logical blocks.

on events from {simSwitch}'s switch
do
    with {actualGroup}
        Set switch to {simSwitch}'s switch
    End with
End on

on events from {simSwitch}'s level
do
    with {actualGroup}
        Set level to {simSwitch}'s level
    End with
End on

Basically what you have now, but split it into two sections. That way, the level is not impacted UNLESS you change the level


#18

I stole that code and have no clue how it was built. I’m very new to webCoRE and just finished consolidating 150 CoRE pistons into 75 webCoRE pistons I’m just trying to clean up the messiness from CoRE.


#19

Splitting the above code in one piston, plus my imported piston should be the answer you need.

Your original code is great as long as you are not trying to sync a SimSwitch in the process


#20

Want me to whip it up for you real quick? Or do you want the practice?