[OBSOLETE] Simpe Volume with Voice

I have 4, but only 1 is selected.

By any chance, did the order of dimmer and Sonos get switched in the setup? That is, can you verify that the virtual switch is the first item selected and the speaker is the second? Can you also check to see if any other speakers are problematic (I’m wondering if maybe that particular speaker is not properly recognized by ST… Ghosts in the machine and all that jazz).

Here is my setup, Jams is the name of the Virtual Dimmer.

I switched to another speaker & I have the same result.

Very interesting. Okay, here’s a few more questions:

What virtual dimmer switch are you using – is it the one I recommended above?

When you’re in the IDE, do you ever see the log.debug text “in handler with $blah blah blah” show up when you adjust the dimmer’s value?

And in my configuration, I leave the “assign a name” field blank (like the mode restriction, it’s a default field for naming the app). In terms of tracking down the issue, I highly doubt this will make a difference, but would you mind removing the name from the field and trying again?

See… What’s confusing me is that error in the IDE you found refers to a command “getDeviceDataByName” for the Sonos player… But my code doesn’t use this command. Instead, I use setLevel for the Sonos player, which is listed as an available command in the same error log(??!!).

I’m using Michael Struck’s Virtual Dimmer.

I ran the live logging and then adjusted the volume, then did a search for log.debug but it showed no results.

I removed the app and re added from scratch without the “assign name” It made no difference.

For basic Sonos controls (play, pause, skip, last song, mute, volume, and playlists) via Alexa, I’ve found that the Yonomi skill works great.

1 Like

Sonos is currently working on their own direct integration with Alexa/Echo
that should be out soon. Sonos just released a beta of their Spotify
integration that lets you control your Sonos system from within Spotify
without using the standard Sonos app. We just started testing the
integration a couple days ago and so far so good…

Yes, but when is soon to Sonos?

I got my 4 Sonos speakers because they could play my Audible.com books natively.

They took that ability away saying they would put it back soon… That was a year ago.

Sorry if this sounded harsh, it is not pointed at you in any way.

I hear you! I am a Cubic.ai backer and would much rather be going down that
path then the Alexa/Amazon route for voice integration but I have had to
learn the waiting way that soon can unfortunately mean something between
someday and never…

I’m trying the Cubic.ai right now to see how I like it.

Have you looked at Google Home at all?

I like it so far.

I have not looked into Google’s offering. I like the concept of Cubic and
the basic app has come along way but they got way off track with so much
effort into Hue and Nest. The slow to develop AI that originally perked my
interest along with the incomplete cube (the hardware) that has never been
completed along with their choices of HA devices they intend to support is
heading off in a different path then I am comfortable with. They seem to
have issues with ST in general but then most folks do. It probably isn’t
that important given the rate at which HA is growing… we will all be
using something completely different in a few years… hopefully everything
will become integrated into the everyday instead of this hobby approach
with little to no industry standards driving developers to a common goal…

@Fubie Well, you’ve got me stumped here. The combination of what your log is and isn’t showing suggests the smart app isn’t installing right, which … maybe … maybe it’s a copy-paste issue? Really, the biggest clue is in the IDE log you sent, which is referring to a function that isn’t even in the code. I wish I could sit down with you side-by-side to look at what was happening in real time so we could chase this down and get it working. Do you have any interest in doing something like a Skype chat with screen share so we can go through it? If so, PM me and we can set something up.

Otherwise, I suppose the other option is to wait for the direct Sonos-Alexa integration. Like others (@infofiend, @susanandmichaelw, and just about everyone else in this forum) I’m super excited for this to come out. It really is a must-have functionality, and will most likely make my little smart app obsolete. In my experience, Sonos really does have a good track-record with their products, even if they are very slow to update.

As for Google’s HA offering, I was generally neutral. Yes, it’ll be cool to connect things to Chromecast (which I find we use more and more for YouTube junk). And I strongly suspect Google’s ability to answer random questions will rapidly catch up with and surpass Alexa. However, the ability to do Amazon Prime ordering-by-voice has become a real treat and that’s enough to keep me on the Amazon platform… for now. But I think @susanandmichaelw is right – at the current rate, two years from now, who knows what we’ll be using.

Brief follow up on the conversation. @Fubie and I video chatted last night and looked into the problem. Turns out GROUPED Sonos speakers throw out errors in the capability.music player setlevel() command. By ungrouping the speakers, we found everything worked as intended.

The other thing we noticed while debugging was that Alexa’s reserved words, although necessary, can be annoying. :stuck_out_tongue: Does anyone know if there’s a published list of all the reserved words? If so, linking it here would be helpful.

Related reading:

Hi. Any way to integrate the phrase “Turn it down on Sonos” instead of setting a specific volume?

The idea being it would turn it down by a default value.

I am still pretty new to ST, and I am trying to use my hub to limit the maximum volume via CoRE and the Sonos Bridge Dimmer outlined in this post. I have successfully set it up so that if the volume is adjusted with the virtual dimmer, it reverts back to it’s set level. However, if the speaker volume is set in the app or on the speaker itself (or on the SONOS title on actiontiles), it is unlimited. Does anyone know how I can get the virtual dimmer to update it’s volume with the volume on the actual device?

Hi @Rancod99 – From what I understand, the Alexa-Sonos integration allows you to use the phrase "Turn down the " in order to adjust dimmer device types. So if you named your Sonos something like “Kitchen Stereo”, then the phrase “Turn down the Kitchen Sonos” should bring the volume down by around 10 or 25 % (I forget exactly what the number is). I personally find this command too coarse, so I often instead refer to specific values in voice-commands like “Alexa, set TV Sonos to 25” or “Alexa, set TV Sonos to 30”. My wife seems to have adapted to the voice functionality quite nicely, but personally, I use the volume rocker on my phone to make fine adjustments when we’re watching a movie and we don’t want to wake up our kid. More specifically, to your question, there is a default value that’s implemented when you simply say “turn down…”, but I don’t think you can pre-set the default step-size. As a result, it may work for your use-case, or it may not.

And Hi to you too @mikedebski! Short version – I believe it is possible to have the feedback you’re looking for, however I don’t think it would be the instantaneous feedback that would provide the desired functionality.

Longer version – if you look in the documentation there’s a section for music players specifically tailored for Sonos functionality:

http://docs.smartthings.com/en/latest/capabilities-reference.html#musicplayer

In the attributes section there is a status string that can be retrieved from the Sonos. I believe the status string should provide the volume level, and you can imagine an app that polls the Sonos’ volume level on a regular basis to check whether it’s above a certain level. The problem is that this app would have to poll on a regular interval, which if you read about scheduling commands in the ST documentation is somewhat cumbersome to do in real-time. What you want is a command that notifies you when the volume is adjusted so you can run a check on whether the volume has exceeded a threshold value. As-of-yet, Sonos has not provided that in their API and as a consequence, it’s a limit to what you can do within ST.

My biggest disappointment is that I released this app around the time Sonos announced Alexa-Sonos integration and they promised it around 4th quarter of 2016 or 1st quarter of 2017. Well, we’re now around the beginning of 3rd quarter in 2017 and as a member of the Sonos Beta Tester Community, I can say I haven’t had a chance to test it out yet (although that doesn’t mean other beta testers haven’t been testing it). I guess Sonos has a reputation for slowly and deliberately releasing products that are fully-market-ready – I take their delay to mean that they are making sure Alexa-Sonos will be 100% when it’s released. Nevertheless, the “Simple Volume with Voice” app here intended to be a short-term solution until the official integration was released.

No sooner do I open my mouth, and then this:

Thanks for the app and reply. I was a beta tester on the Sonos/Echo integration. Half way through the beta, they decided to drop support for controlling all speakers; hence I can no longer control ( via voice ) the volume of all my 3 Sonos speakers. This is where your app came in handy.

@Rancod99 I hope it helps! Having spent time yesterday setting-up and playing with the Alexa/Sonos integration now that it’s open Beta, I’m a bit underwhelmed. It seems (1) there’s confusion with my ST devices with highly similar names (e.g., Living Room is the room for a speaker, but it’s also the name of a group of lights), and (2) functionality with the PlayBar isn’t as advanced as the Play:3’s. I’ll give it a week or two to see what use-cases it’s helpful for, and which it’s unnecessary.

As a foot note, I’m constantly surprised by my “lived experience” in discovering the differences between “cool” and “useful.” If asked to predict whether a new device/app/whatever is “cool” or “useful”, I’d probably be wrong 9 out of 10 times. Seriously, a coin-toss would be more accurate in the long-run…

I know it’s been over 2 years, but I just updated Sonos to the new device type and broke this app. In the interest of completeness, here’s the revised code:

/**

  • Dimmer-Sonos Bridge
  • Copyright 2016 Jesse Silverberg
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.

*/
definition(
name: “Dimmer-Sonos Bridge”,
namespace: “JLS”,
author: “Jesse Silverberg”,
description: “Bridge a virtual dimmer to a Sonos for Alexa volume control.”,
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
section(“Bridge this dimmer…”) {
input “myDimmer”, “capability.switchLevel”, multiple: false, title: “Choose virtual dimmer”, required: true
}
section("…to this speaker") {
input “mySpeaker”, “capability.mediaPlayback”, title: “Choose Speaker(s)”, multiple: true, required: true
}
}

def installed() {
log.debug “Installed with settings: ${settings}”
subscribe(myDimmer, “level”, setNewVolume)
}

def updated() {
log.debug “Updated with settings: ${settings}”
unsubscribe()
subscribe(myDimmer, “level”, setNewVolume)

}

def setNewVolume(evt) {

log.debug "in handler with: ${evt.value}"
def newVolume = myDimmer.currentState("level").integerValue
mySpeaker.setVolume(newVolume)

}