I simply added the following capability to the device handler…
capability "Switch Level"
After doing this you should be able to say “Alexa, set #DeviceName to 70%” and the volume will change (note: I enabled the logic in the device handler so my volume can is set between 1 and 100).
Thanks for coming up with this. I can control one of my Yamaha receivers but can’t figure out how to add my other one.
Do I have to change and reinstall the device handler and smart app for a 2nd receiver?
Thanks
Using Alexa Helper I have created two virtual momentary buttons, one for volumeUp and one for volumeDown. When each is “pushed” they invoke the corresponding command on the Device Handler.
I then defined a third virtual dimmer and used CoRE rules so that when the dimmer goes up, it pushes the volumeUp button and when it goes down it pushes the volumeDown button.
I allowed Alexa to discover the virtual dimmer and put it in an Alexa group called “television”.
I now say “Alexa, turn up the television” and the volume goes up. or “Alexa, turn down the television” and the volume goes down.
@farnigus yeah that would require a complete rewrite to support MusicCast… have actually thought about building a good, generic DLNA controller but haven’t gotten around to it.
I made the change to line 21 and I thought it was good. I entered the info into the newly created SmartApp, when I pressed done, I got “Error Saving Page.” I edited the code again and still got the same message. Any ideas?
Thanks
So I would like to use this with GH in a similar fashion as you. I’ve been trying to figure out how to change the volume from being displayed in +/- DB and into a 0…100 range. I can’t figure out which lines of code to adjust/replace. I’ve been using the latest code provided by @redloro. and this is what I currently see for the volume section.
It looks a bit different from what you have posted and I’m not sure what needs to stay vs. what needs to be replaced. I use 2 zones: main and 2 (don’t use a “zone b”) Could someone help me out? Also, does anything need to change in the SmartApp? or just the DH? I tried replacing some lines, but then I was getting errors when trying to install the app.
This is great app. Has given new life to my receiver. Just a question on how to change the volume scale to 0…100. Could you provide some instructions on which 3 lines need to be swapped out? and with what to replace them with?
Below are the three areas that needs to change. You can copy paste the below code in their respective places and it should work. The change is the comment (forward slashes) on a different line.
Note: In Change two, I added three lines
if (value > 50){
value = 50
}
This sets the volume to 50% if the receiver gets a command for a value greater than 50% for any reason (intended or by mistake). You can delete those three lines if you do not need the limit but my recommendation is to keep it and change the limit to your needs.
This has been really interesting getting my Yamaha and Smartthings Hub and Google Home working together and many thanks to everyone on here for educating me.
So far I can use Google Home to turn on and off my Zone 1 and Zone 2 using the following voice commands:
"Ok google turn on Zone1"
"Ok google turn off Zone1"
"Ok google turn on Zone2"
"Ok google turn off Zone2"
But I haven’t been able to figure out hot to get Google Home to do the following:
Change Source
Change Volume
Is anyone using Google Home to perform these functions and, if so, what are the actual voice commands that you use?
@bmcgarry67 updated the SmartApp and Device Handler to support multiple receivers… if you update the app and handler, you should be able to add as many SmartApps as you have Yamaha receivers… just give it a unique name and it should work.
I just updated to the latest app and DH and while I get no errors in the iOS app I am getting this in Live Logging and my receiver is not responding to any commands. The Thing is responding to Alexa though.
error java.lang.NullPointerException: Cannot invoke method children() on null object @ line 67
debug getChildDevices(false), children=8
Oh yeah…Forgot to mention that you can’t do an in place upgrade of the code. You actually have to first delete the smart app and devices, then install the new code, then re-add the smart app which will create the respective device.