Script problem with Sonos

I am using scrips to switch on the Sonos and play for specified time. I can change the station but I can not switch the Sonos off I am also not in a position to change volume.