Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 10 of 175

Threaded View

  1. #1
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    433

    [Announce] LMS-lite certified Smart Home skill for Alexa

    LMS is so awesome, it deserves more than just one certified Alexa skill to control it. That's why I've released a second and very different skill that complements MediaServer and nicely co-exists with it. Just like MediaServer, because it's a certified skill you do not need any developer or beta accounts to use it.

    Name:  lms-lite - small.png
Views: 2078
Size:  15.4 KB

    It's called LMS-lite and unlike MediaServer which is a custom skill, this one uses the Smart Home paradigm. While the downside of this is far fewer and more limited commands compared to MediaServer, the upside is that there's never a need for an invocation name (so commands are shorter), plus, your LMS players show up as smart-home devices in the Alexa app. That means they can be included in groups with other smart home devices and used in routines to do clever things like switch an amplifier on/off together with a Squeezebox. LMS-lite is always free, and will be available (soon) in languages other than English.

    With the Smart Home paradigm, Amazon has pre-written a bunch of voice commands to control Smart Home gadgets. A skill author cannot extend or change these, but they do provide basic/useful functionality and are available for several languages. There's a pool of so-called interfaces that a skill can declare an endpoint/device to support during device discovery. For this skill, I've included everything from this (current) arsenal that could possibly work with LMS: Alexa.PowerController, Alexa.Speaker, Alexa.PlaybackController, Alexa.RangeController, Alexa.ModeController, Alexa.ToggleController and Alexa.EndpointHealth. The reason I'm listing all this here is so that you can go check the Amazon docs on those interfaces if you want further information: https://developer.amazon.com/en-US/d...nterfaces.html

    LMS-lite uses exactly the same account-linking process as the full-function MediaServer skill, where most people use ngrok for external accessibility and encryption/password-protection. Because it's a Smart Home skill, with LMS-lite you must immediately account-link during enablement. The howto is at https://smartskills.tech/lmslitesetup but if you already have MediaServer then you will be familiar with the idea.

    Once you link the skill successfully, you just say Alexa, discover devices. She will do a round-robin with all of your Smart Home skills and all your gadgets will be reported by their associated skills. LMS-lite will report your Squeezeboxes, so Alexa should tell you that there are some new devices available now. She may name a few informatively and mention an example command to try, but that's up to Amazon (in her summary, Alexa might instead mention a different smart home device category which coincidentally uncovered a new device during discovery). Remember, with Smart Home skills, the skill itself never directly determines what Alexa says. If you subsequently discover devices she will not mention any LMS players as they are then already known to your Amazon account from previous discoveries (it's not like with MediaServer, which always mentions all your players on every discovery). Anyway, whatever Squeezeboxes were revealed will always be visible in the Alexa app in the display category MUSIC_SYSTEM. Here's an example:

    Name:  IMG_3734.PNG
Views: 1562
Size:  26.8 KB

    During discovery, your player names are untouched by the skill and reported as-is to Alexa (except for removing disallowed characters). If you have unwieldy player names like Onkyo-XTR672VMK, you might want to edit/change them because you cannot abbreviate device names much when commanding. You can rename players textually in the Alexa app, which is a nice side-effect of their showing up there (you can also delete players from the app). This will of course only affect their names as known by Alexa, and not touch your source LMS names. It's probably smart to tack on ' player' to the end of each device name if you are using room-based naming in your house. Otherwise you risk being told that 'More than one device(s) share that name, which one do you want?', every time you issue a control directive. At a minimum, split concocted names like 'rearupstairsbedroomtouch' into a few separate words - this is after all voice control and not UI navigation. But unlike with MediaServer, there's no preference for a room barename as basis. You are free to call your players anything that can be reasonably enunciated. Yaay!

    So, what commands do we have available? The following examples are for English and are on an interface-by-interface basis and assuming a Squeezebox called Touch for example purposes. Once a player name has been mentioned in any of the commands, it persists until a different player is mentioned or a different music-playing skill is launched from that Echo. The examples below omitting 'Touch' in them assume that fact and will not work if no previous command recently mentioned Touch. If in doubt, always mention the player name in the command. Each Echo has its own persisted Squeezebox too, so remember that fact if you move to another room and issue a name-free command. Don't blame/credit me for these utterances, they're Amazon's work:

    Alexa.PowerController gives us power on/off.
    Examples:

    Alexa, power ON the Touch
    Alexa, power OFF the Touch
    Alexa, turn ON the Touch
    Alexa, turn OFF the Touch
    etc.

    Alexa.Speaker gives us volume control and muting.
    Examples:

    Alexa, set Touch volume to 70
    Alexa, volume 20 on Touch
    Alexa, increase the Touch volume by 10
    Alexa, pump up the volume
    Alexa, pump it up
    Alexa, louder
    Alexa, make it louder
    Alexa, louder please
    Alexa, quieter
    Alexa, tone it down
    Alexa, lower the volume
    Alexa, decrease the volume by 20
    Alexa, mute the Touch
    Alexa, unmute Touch
    etc.

    Alexa.PlaybackController gives us transport commands.
    Examples:

    Alexa, next track on Touch
    Alexa, next
    Alexa, skip this
    Alexa, previous track on Touch
    Alexa, previous
    Alexa, go back
    Alexa, play on Touch
    Alexa, resume on Touch
    Alexa, pause
    Alexa, stop
    Alexa, rewind (not native on LMS but skips back 60 sec)
    Alexa, FastForward (not native on LMS but skips ahead 60 sec)
    Alexa, start-over (goes to track 1)
    (note that play/resume can misbehave and kick off your most recent stream-to-Echo from another Music skill instead of sending a Smart Home command to LMS - it all depends on your recent history of commands)

    Alexa.RangeController gives us setting and querying the track index (first track is 1) and numbered favorites.
    Examples:

    Alexa, track 7 on Touch
    Alexa, song 9 on Touch
    Alexa, what track is the Touch at?
    Alexa, what track is the Touch on?
    Alexa, favorite 3 on Touch

    Alexa.ToggleController gives us setting and querying of both loop (repeat album) and shuffle-play (shuffle by song)
    Examples:

    Alexa, turn ON 'loop' on Touch
    Alexa, activate 'loop' on Touch
    Alexa, turn OFF 'loop' on Touch
    Alexa, deactivate 'loop' on Touch
    Alexa, is 'loop' ON, on Touch?

    Alexa, turn ON 'shuffle play' on Touch
    Alexa, activate 'shuffle play' on Touch
    Alexa, turn OFF 'shuffle play' on Touch
    Alexa, deactivate 'shuffle play' on Touch
    Alexa, is 'shuffle play' ON, on Touch?

    Alexa.ModeController gives us more control of both repeat and shuffle.
    Examples:

    Alexa, set 'repeat mode' on Touch to 'OFF'
    Alexa, set 'repeat mode' on Touch to 'song'
    Alexa, set 'repeat mode' on Touch to 'playlist'
    Alexa, set 'repeat mode' on Touch to 'album'
    Alexa, what is the repeat mode on Touch?

    Alexa, set 'shuffle mode' on Touch to 'OFF'
    Alexa, set 'shuffle mode' on Touch to 'song'
    Alexa, set 'shuffle mode' on Touch to 'playlist'
    Alexa, set 'shuffle mode' on Touch to 'album'
    Alexa, what is the shuffle mode on Touch?

    To control a player in an Alexa routine, in the Alexa app select routines and under add/edit routine, as an action select Smart Home. Under All Devices you should see your players among your other Smart Home devices. If you select one of your players, you will see the options for Power, Loop, Repeat Mode, Shuffle Mode, Shuffle Play and Track (see image below). Under each of those will be options like On/Off or Off/Track/Album, and, for Track, a slider to set a value from 1 to 200. You can specify more than one category and have them all triggered at once when that action runs. Note that if you have no recognized event-triggering devices such as door contacts or motion sensors, you may not see any Smart Home devices under actions. In that case, you can still add the players to groups so they at least power on/off with the other devices in the group, although you then have less settings options than in routines.

    Name:  IMG_3730.PNG
Views: 1929
Size:  23.2 KB

    If you have any connectivity errors with your proxy, such as bad or expired cert, upstream proxy issues, auth details wrong, etc, then Alexa will issue a standard Amazon warning message based on the BRIDGE_UNREACHABLE error which the skill returns for an unresponsive LMS. Because there cannot be a custom and more detailed/specific error message, you should assume if you get that standard message that your proxy or LMS itself is down and that, at a minimum, you need to troubleshoot your full cloud-to-LMS connectivity chain.

    In my testing, Toggle and Mode controllers are a both still flaky but Range is rock solid (all 3 are relatively new capabilities). Amazon still has some work to do. The other stuff is bulletproof.

    EDIT: Note that it's perfectly OK to use the same ngrok tunnel for both LMS-lite and MediaServer. If you have any account-linking issues then it should *not* be necessary to unlink either skill just to get the other one working. It's also possible/allowable to use different names for the same player across both skills, should you desire.
    Last edited by philchillbill; Yesterday at 11:46. Reason: New commands

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •