Help Combining Two Small Pistons


#1

I have two pistons which determine what mode to set SMH alarm when I leave. I have been trying to combine them into one, but, am having mixed various results, none of which work correctly.

Can someone look at my two pistons and tell me the proper way to combine them? I’m struggling…



#2

Something like this?


#3

Another version:

   ONLY WHEN
       Location mode is AWAY
    IF contactSensor is open
       Set SHM status to stay
    ELSE
       Set SHM status to away
    END IF

#5

Even better


#6

Here is @elf’s solution


#7

Thanx Alan … I don’t have access to webCoRE here at work :angry: … what’s the world coming to? LOL


#8

Thanks for all of the great responses! I have a lot to learn… I’ll incorporate the more efficient solutions you have offered! I knew there was a better way, just wasn’t sue how to get there… Thanks again!


#9

Well… I copied and implemented the code. Makes perfect since to me, but, it’s not changing SHM status…?

If I go back to my two pistons, it works… Any ideas? I’m running my “I’m Back” and “Goodbye” routines to test. Part of each routine is set mode to “Home” or “Away” depending on the routine.

alarm


#10

Move line 17 into the IF block (as in your original pistons) and see if that makes a difference. I’ve had some wonky behavior using ONLY WHEN at times. :man_shrugging:


#11

Here’s what I did and it seems to be working:

I have read threads on the differences of “is” and “changes to” but I’m still confused. I’m not sure which one is best suited for this purpose…

My little experience makes me agree with your comment/suggestion.


#12

For this instance, it doesn’t make a difference …

" … experiment …"
Dr. Frankenstein