Pause Music when Motion Stops


(Alan Moore) #1

Hi everyone. I’m a fairy new user of SmartThings but a long-time programmer/system integrator. I was looking for a way to stop the kids’ Sonos players when they have gone out/to school, and could not find a SmartApp that has that functionality. The smart lighting works great for when they leave, but I noticed that Sonos was inconsistent when you use it as a switch and try to turn it off.

I have published a parent/child SmartApp that allows you to choose speaker devices, associate them with a motion detector and set a timeout period. To handle situations where the motion detector is already ‘inactive’ when the app is installed, I’ve implemented an internal timer that will get cancelled/ignored if motion is detected. The app issues the pause() command to the speaker. I works great with Sonos; I hope it is as useful with any other SmartThings connected music players.

I hope you find it useful, and please let me know if you find any bugs or have improvements I can make.

Find the SmartApp here: