New Version Available
Just finished uploading new version of the code. This version includes new functionality and a smartapp for voice/routine control. As usual, there will probably be issues, since my testing is limited to me. Installation method has not changed.
New functions include -
Speech synthesis. The speak(msg) command has been implemented using Smartthings text to speech. You can pick the voice you want to use. I’ve tested this a bit with Big Talker 2. Report back if you find issues with it or other apps, I’ll be curious to see what happens. It seems to work fine as either a music player or speech synthesis device. The speak command will attempt to restore the player to it’s state before the speech event is sent. Shuffle may result in a different song, since saving a playlist is shuffle order isn’t supported in the API being use. There are some other quirks, see below.
Three new preset buttons. These are to allow starting music within Smartthings. You will need to load a LMS HTTP API command into the settings. See documentation on Git on how to do this. With this you should be able to automate music. New commands associated with this are button1(), button2(), and button3().
Repeat control has been implemented.
Several new player settings to customize player action, see Git documentation.
I have been testing this with a Boom, a piCorePlayer, a Google Home, and a Google Home Mini. All play music fine, but speech presented a few issues to overcome.
Speech, in general, produces a short track to play. For most players, this is not an issue. However, the SqueezeLite implementation has a known problem with very short tracks, under 5 seconds seems to be the limit I found. The player will appear to be playing, but produce no sound, and the timer will continue to increase or loop. The solution is more verbose speech, usually adding a phrase to get beyond 11-12 words is enough. To help prevent this, there is an option on the player handler to mark it as a SqueezeLite, and a warning message will be generated if the resulting speech track is too short. I can’t test for this if you are using BIg Talker 2 as a music player, since it is already padding duration information beyond the minimum. So, if you see this problem, add more words to your announcement. My piCorePlayer is SqueezeLite. Even though Chromecast devices report as SqueezeLite, they do not appear to have this issue, I think due to different connection methods.
However, if you implement Phllipe’s Chromecast plugin in LMS, please read his documentation. I cannot help with issues there. Things that do matter, volume is set by default to only update while actively connected. It can be changed. Second, the server has to reconnect if the connection has been terminated or interrupted. Sometimes this manifests as a speech event not playing on the first attempt. I’ve added a longer delay before resetting the player to try to minimize this. So, your Chromecast for speech experience my not be 100%. Feedback is appreciated, you will probably think of something I missed.
Hope you have fun with this.