No announcement yet.

Sonos Playlist Control via Elk Alarm Keypads

  • Filter
  • Time
  • Show
Clear All
new posts

    Sonos Playlist Control via Elk Alarm Keypads

    I am posting the script I am using to control my Sonos audio system from my Elk Alarm system keypads.

    This script allows the end user to select and play a Sonos playlist using a single key on the Elk Alarm system keypad (usually a function key). If the zone is currently playing music a single push of the Fkey will pause the music (or stop it if it is a internet feed).

    Note that two 3rd party plug-ins are required to use this script:
    HSPI UltraM1G written by HS board user "Ultrajones"
    PI-SonosController written by HS board user "dcorsus"

    Though I expect that most folks that have this hardware already have these plug-ins.

    My sincere thanks go out to the authors of both of these fine plug-ins, for their hard work and assistence in helping me understand the functionality (and adding some). Even if you do not use this script I highly recommend purchasing these plug-ins if you own the respective hardware.

    Functionality Overview
    If the zone is not playing, the elk display will display a playlist name when the Fkey is pushed. Each time the Fkey is pushed the elk display is updated with the next configured playlist. If the user stops (no more pushes) with with a playlist displayed, that playlist will start playing in 3 seconds

    If the zone was paused, the fist push will display "Resume Current" which will un-pause the zone and continue from where it was paused. If the zone was stopped, the first playlist defined for the zone is displayed on the Elk keypad.

    If the user pushes the Fkey until "No Change" is displayed, no playlist will be loaded and played.

    The script is normally assigned to "Elk M1 Keypad KeyChange" triggers for the Fkeys. This script may be used for different keypads and zones by passing the proper parameters (see the "Key" function in the script for more details). Therefore using different events for Fkey presses on the Master Bedroom and Family Room Elk Keypads can control the zone player in each respective room. Each zone can have its own selection of playlists and volume settings

    Note that due to the firmware of the Elk alarm system, the display will change on each keypad in an Elk "Area", however the Sonos action will only take place for the specified zone.

    Since I personally, don't like alot of HS Events and extra Devices in my Homeseer system. The playlists and actions are not predefined in HS. This script will create (and delete) all required events on the fly. No additional HS devices are required or created.

    This script must be modified to work with your local configuration of Sonos zones and playlists. See the comments in the script to accomplish this. Hopefully there is enough information to let you know what needs to be done.

    Disclaimer: This is my first attempt at a VB.NET script (previous HS scripting was all perl), therefore while the script works for me, there may be issues that I am not aware of and I am sure there may be better methods to accomplish the tasks at hand.

    Please feel free to provide any feedback regarding the script.

    I believe there are much simpler ways of triggering playlists from an Elk keypad. Such as using predefined events for each playlist and zone combined with the HSPI UltraM1G plug-in's capability to trigger events on invalid user code entries. As I mentioned above I prefer to have everything in one place and I wanted a menu system that made it so that family members do not have to remember anything more that pushing the F1 key.

    Attached Files