1) Give a description of the problem
Is it possible to pause a piston until the state of a device (or group of devices), specific attribute changes to another specific attribute, then continue executing the remaining tasks in the piston?
Would I use Loop “For” or “While” or ??? looking for some guidance and examples, please?
Please note I am aware I can accomplish this using a Harmony or IFTTT but the goal is to do it all within Webcore. I don’t want to pay for an additional service or buy an addition device. I am also aware of the jishi/ node-sonos-http-api but am not interested in setting this up.
2) What is the expected behaviour?
I have written a piston that groups several devices (Sonos Speakers) together then when the grouping is complete, adjusts the volume of each device and finally sets the music selection. This is all initiated by an Alex Simulated Virtual Switch, thus allowing me to use Alexa to trigger the request or another piston to turn use the switch.
See the Green Snapshot below for details, verbally what I would like to happen the following is…
If GroupedPlayerCheck is FALSE
- Turn ON Sonos House Group Set
- Wait until GroupedPlayerCheck is TRUE
- Turn OFF Sonos House Group Set
- Continue processing the remain of the piston
Note: Just for clarity “Sonos House Group Set” is an Alex Simulated Virtual Switch, that when turned ON runs an Alexa routine that uses a custom action that calls the Speaker Groups Skill, making use of a Speakers Scene which groups the Sonos devices.
More information can be found here if you have any interest:
3) What is happening/not happening?
While I could just use a WAIT for X number of seconds, which I have tried. The wait period can vary based on the number of devices to group, network traffic, the phase of the moon, etc. The issue I am having is the different times (delays) that it takes to group the devices.
4) Post a Green Snapshot of the piston
(UPLOAD YOUR IMAGE HERE)5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)
REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.