Does not have to be ungrouping, a simple stop would be enough I think.
Okay, so there’s some good news and some not so good news!
I have created an activity within my Harmony Hub that selects my Arc in the lounge and my Beam in the kitchen.
Running this activity, removes these two speakers from any other Sonos group they may have been in before and creates a new Sonos group 
However, this breaks the TV audio input to the Arc and so, although grouped, no audio is heard anywhere! 
Notwithstanding this, I have created a rule in Hubitat that will create the grouping when motion is detected in the kitchen during the evening, although again the audio is stopped!
With some more work, I’m sure it could work but you would need Hubitat and a Harmony Hub to do it. Voice control through Alexa can invoke the Harmony activity as well, so you could take Hubitat out of the solution if you wanted to invoke it via voice.