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
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.