Multi switch best practices (show status & trigger actions) without loops

Hi,

Problem Statment:
When using pleg to sense device status to set a multiswitch button, and use the same button as a trigger - pleg can enter a loop. This is particularly problematic when optionally controlling a device from Vera or its native interface

Scenario:
Use a multiswitch to join sonos players and start or stop the groups.
If the sonos is played from its app, I want the multi switch play button to light. I would also want to start playing by hitting the same button.

Things I’ve tried:
Create a pleg outofsync condition, and compare the virtual switch to the actual state
Compare times when out of sync
Threaten wife not to touch
Use a counter to trap a loop
Use a variable container to hold a flag for x seconds

I have the sonos actually working, but it is very ugly, and I am afraid to edit it. I am now automating pool functions like a light, water feature… When convenient,i will hit a remote control. On a timer, or as a Convienience, I may hit the virtual switch from remote.

I am wondering if there is a template or best practice I should implement.

You will not get much help without posting your status report in PDF format.

Thanks - I was looking for a simple block diagram.

What I am posting works, but I am looking for a more efficient implementation. The goal is to use a similar setup to automate a ppol. With pumps/valves… - I can’t have any mistakes. Messing up a sonos is no big deal…

Attached is a diagram of the system - and the PLEG status for the two devices. In the diagram, the black arrows are the offending actions. i.e. - If I use a multiswtch state as a trigger to set a sonos to play. That is fins. If I them hit play from the sonos app, and use pleg to set the Multiswitch play button to “on” - the loop begins.

Like I said - it works, but it is not efficient.

Any thoughts are appreciated.

You need to create a SINGLE PLEG that demonstrates what you are trying to do and what the problem is.

Trying to extract the logic behind your setup with TWO interacting PLEGs is beyond my attention span to look for and then try to solve a problem.