Problem with Sonos notification sound

For information, this seems to work for me since a couple of days: no wierd music volumes before and after playSound notificaton.
Strategy when a notification needs to be triggered: store Sonos state, pause Sonos, wait 1 sec, notify, then restore Sonos state as before the nofification.
For some reason I do not need another wait after the playSound.

Temp_Sonos_State = Sonos_State.state
Sonos_Controller.sendCommand(PAUSE)
ShortTimer=createTimer(now.plusSeconds(1)) [|
	playSound("XX.mp3", new PercentType(40)) 
	switch (Temp_Sonos_State)
	 	{case "PLAYING":
				Sonos_Controller.sendCommand(PLAY)
		 case "PAUSED_PLAYBACK":
				Sonos_Controller.sendCommand(PAUSE)
		 case "STOPPED":
				Sonos_Stop.sendCommand(ON)
		}
	ShortTimer=null
	]
1 Like