One of my Sonos connect’s is playing to TWO zones through a 2-zone amplifier. I have a Homey Flow to play Sonos when the lights are turned on in Zone 2, and pause when the lights go off in Zone 2.
However, since the Sonos is shared with Zone 1, the stop command above also stops playback if it was started manually in Zone 1.
So, the automation I am trying to create is like this:
Store current Sonos_status in a boolean variable (or flip a virtual switch).
If lights on, start Sonos playback in Zone 2 (if it’s on already, it is not affected, so no extra conditions here)
When lights go off, THEN IF Sonos_status=false (ie it was NOT playing already), THEN STOP Sonos.
Otherwise, do nothing so it keeps playing if it was playing already.
But I couldn’t find a way to set the variable using Sonos as a CONDITION, only as ACTION ie not being able to store its status.
Here’s a rather convoluted solution I am thinking of:
I also have my Sonos exposed to Apple’s Home via homebridge.
So the idea is to set up a Virtual Devices switch in Homey as my boolean Sonos status “storage”, expose it to Homekit via Sprut Homekit Homey App and have its status changed by a simple Homekit automation, sth like When Sonos (it’s an on/off switch in Apple’s Home App) is On, Turn Dummy Switch On. When Off, turn Off.
I assume this will get “reported” back to the Homey world.
I would then use it as an AND condition for turning off Sonos playback when lights are switched off (manually, or on timer) - so that if the Sonos was on when the whole thing started it won.t be turned off when it ended.
But my question in reference to your response is how do I “extract” the Sonos status in Homey at all?
For me the ‘playing’ tag also toggles when using the sonos app, or control the sonos by pressing the fiscal button. So i guess it does not have a sync issue there…
Not sure how to use tags to ascertain Sonos status, will read some more. My idea, on a second thought, won’t work since the “storage” switch will be updated and forget its past status the moment Sonos starts playback. So that was dumb
The solution i am thinking of is turning off Sonos when countdown reaches zero, but this timer will ONLY start if the Sonos is off in the first place as reported back to Homey from Apple Home through a virtual switch… I am not making any sense, am I?
If it was not playing, why stop them?
And why save the status in a boolean while u have the status in the tags?
IF lights go on AND sonos tag is “playing” THEN do whatever u like.
Or u confused me too much alr.
On the top of ur flow page there is a “Tags” section. Click it and find ur Sonos speaker. There u will find the tag.
Also in the pic @anon2681894 was showing u a few posts up.