Searching for a custom Sonos DT for playbar/alexa

I have searched and searched and can’t seem to find anyone with a similar issue to me. I just added a playbar to my house, on top of existing sonos zones. I want to be able to play both music and tv through both the playbar and the connect amp wired to ceiling speakers, for surround sound on the TV and fuller audio on music. Pairing them all together is not an issue. When you add in automatic ungrouping on TV sound detected, smartthings, and alexa, everything get’s completely confused.

I used to say “turn on sonos” to get whatever was most recently playing on the connect. Now, when the TV turns on, the playbar becomes the “group coordinator” and the track description of the connect is “paired with playbar,” and the previously stored music data is lost. So saying “turn on sonos” essentially plays the TV audio, which means nothing happens because the TV is off.

I attempted to use webcore to store the track data whenever the track description is not paired with playbar. That works fine. Then, every time the audio from the TV stops, I tried to set the track of the sonos system to the variable stored in the piston. The command gets sent to the sonos device, but nothing actually updates. I think this is because the playbar is still the “group coordinator,” even though I have tried sending the set track command to the playbar and the connect individually and concurrently. It seems like the actual commands aren’t worth a damn.

The harmony hub is seriously lacking in commands to send to sonos. Setting the track isn’t really possible outside of favorites, and I can’t find a way to set a single favorite that updates to the most recently played music.

Yes, there is a sonos/alexa integration coming, but I don’t believe it will be phenomenal. I prefer to just say turn on sonos and get what I was listening to, and be able to do that even after watching TV. Any ideas?