SmartThings Community

[RELEASE] Yamaha Network Receiver Basic Integration

smartapp_av
dth_av
zone

(James) #61

Any insight on how you have Alexa controlling the volume? Switching sources?


#62

First I’d like to thank you for all the effort and I’m really looking forward to get my TX-NR636 running!

I’ve imported both the SmartApp and the Device Handler but any action on the device will result in the following error in the live log:

org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 3; The element type "HR" must be terminated by the matching end-tag "</HR>". @ line 135

The TX-NR636 should be supporting eISCP, but it seems you are not using eISCP?
The HTTP commands you have suggested to Oleg_W indicate to me that my Receiver is not providing the output you would expect.

Accessing the CTRL Url unfortunately results in a 404 Not Found, served by thttpd/2.25b_29dec2003

http://<MY_RECEIVER_IP_ADDRESS>/YamahaRemoteControl/ctrl

Any chance I get this running on my TX-NR636 as well? Maybe I am doing something wrong or need to change a setting on my Receiver?

Thanks in advance.


(Coreyarb) #63

Any chance something like this would be “easily” modified for a Pioneer receiver (VSX-90 specifically)? Your program looks great. Now I wish I had a Yamaha receiver instead. :frowning:


#64

Is the TX-NR636 made by Onkyo?? This plugin is only for Yamaha receivers that support the Yamaha Network protocol.


#65

Looks like it may be easily modified to support Pioneer receivers… check this and report back:

http://<Receiver IP>/BasicDevice.xml


(Coreyarb) #66

I installed all of your yamaha scripts, entered the receive IP, selected hub, but that does not control the Pioneer yet.

I can get into all of the network settings/setup from:
http://Receiver IP/index.html
I can also get into a “virtual remote” using their interactive guide (example: on my computer, I can click on the interactive volume button and it will control my receiver from my computer):.
Receiver IP/InteractiveOperationGuide/en-US/index.html

After that, I am not sure what to do. Here are some default settings. Do I need to change any of these?
Enable Proxy Server: OFF
Proxy Port: 0
Enable Port 1-3: OFF
Enable Port 4: ON
Port 4 Number: 23

Thanks for the responding! It is often hit/miss on message boards.


#67

@coreyarb this plugin is only for Yamaha receivers… and will not work for a Pioneer receiver. If you want to get this to work for a Pioneer receiver, you’ll need to change the SmartApp and Device Handler code to use the Pioneer specific protocol.

I asked that you check http://<Receiver IP>/BasicDevice.xml to make sure that the device is network addressable… and it looks like it is. If anyone wants to add support for the Pioneer receiver, the protocol syntax is available online.


(Coreyarb) #68

Thank you again for the response. If there are any Pioneer users out there that want to try editing the code, here is a link to Pioneer’s IP stuff. http://www.pioneerelectronics.com/StaticFiles/PUSA/Files/Home%20Custom%20Install/FY16AVR_External_Command_for_CI_2.xlsx

I’ll play with it, but honestly very little experience of coding beyond html and Windows 98 haha.


#69

@redloro Thanks for the device handler!

My stupid Yamaha RX-A2030 can’t remember last Net Radio station it was playing before it was turned off, so I tried to add a button to select a station from my bookmarks. For this I need to send the following command 3 times (Bookmarks > My__Favorites > First Station on the list)

I need to add about 2sec delay between the commands, but I can’t seem to figure out how to do this?

I tried this:

def NetRadioStation() { delayBetween([ sendCommand("<YAMAHA_AV cmd=\"PUT\"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>"), sendCommand("<YAMAHA_AV cmd=\"PUT\"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>"), sendCommand("<YAMAHA_AV cmd=\"PUT\"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>") ], 2000) }
But there is no delay, it still sends the commands too fast. I’m new to SmartThings and Groovy, so maybe I’m doing this the wrong way?
I found this old topic delayBetween(cmds,<timeinms>) does not work it discusses that the delaybetween doesn’t work. Can it be that it still doesn’t work? Any other way to send 3 commands with a delay between them?

I also tried to call NetRadioStation() with CORE piston 3 times and I added wait 2s before every command, but this didn’t work either. So I’m out of ideas.


(Stuart Buchanan) #70

I still have issues with delayBetween that was never resolved AFAIK, i just tested on of my device types and all commands execute without a delay.

maybe @Mike_Maxwell can comment as he had a better grasp of the issue and has remained active whereas i’ve not been keeping up with the latest developments for a while.


#71

Thanks for your reply @Fuzzyligic !
So my code looks OK? I was worried that I’m missing something. Like I said, I’m new to SmartThings and Groovy.

I got it working by sending the command 7 times. :slight_smile: But I don’t think it’s a good idea to flood the receiver with commands to get something this simple done. So if anyone has any ideas how to add delay between commands than please share.


(Stuart Buchanan) #72

i have just raised another support ticket with smartthings support, i suggest you do as well about this issue


(Mike Maxwell) #73

I got nothing man…


#74

You could always use runIn() but there is no guarantee that it’ll run at that time… and then have three separate methods, or use a state variable and iterate 3 times.

def NetRadioStation1() {
  sendCommand("<YAMAHA_AV cmd=\"PUT\"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>")
  runIn(2, NetRadioStation2)
}

def NetRadioStation2() {
  sendCommand("<YAMAHA_AV cmd=\"PUT\"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>")
  runIn(2, NetRadioStation3)
}

def NetRadioStation3() {
  sendCommand("<YAMAHA_AV cmd=\"PUT\"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>")
}

#75

Thank You @redloro! This works.


(Dylan Corbett) #76

Wow! Just want to say thank you! Im new to the whole smart things and smart home world but got this app going and am now able to power on/off my receiver using Google Home. Im just curious if anyone has had any luck doing anything else like changing volume or inputs using Google Home? Everything from inside the smartthings app works perfectly. Wondering if there is a specific way to phrase it when talking to Google Home?


(Matthew Budraitis) #77

I’m controlling volume in Google Home. I gave my receiver a nickname of
"volume" in the Google Home app. I can tell it to increase or decrease
volume, but it makes big changes so I mostly tell it to set the volume to
80%, etc.

One oddity, since Google thinks it’s a dimmer, it responds with “setting
the volume brightness to 80%”.

One thing I did modify in the SmartThings code is I changed the volume
equation so that 100% volume in the app is -30dB on the receiver, which is
the loudest I ever turn it up. That way I can tell Google to increase the
volume and it doesn’t go to full output.


(Dylan Corbett) #78

Thats funny! I went into GH and set the nickname of the stereo to volume. I told it to increase volume… It responds “OK, increasing volume brightness” but the stereo didn’t respond to the command at all?

As far as changing that line, which line are you referencing? I found the couple lines by searching for volume…

 // row
//controlTile("volume", "device.volume", "slider", height: 1, width: 6, range:"(0..100)") {
controlTile("volume", "device.volume", "slider", height: 1, width: 6, range:"(-80..16)") {
  state "volume", label: "Volume", action:"music Player.setLevel", backgroundColor:"#ffffff"
}

(Matthew Budraitis) #79

Does volume control work with the slider in SmartThings?

Here’s my revised function. I commented the original code and left myself some notes for the future.

def setLevel(value) {
  
    //-80dB = -800, +10dB = 100, needs to send integer that is divisible by 5
    //Formula is Math.round(value * limiter / 5) * 5 - 800
    //Limiter 5 = -30dB, 6 = -20dB, 7 = -10dB
    //sendCommand("<YAMAHA_AV cmd=\"PUT\"><${getZone()}><Volume><Lvl><Val>${(Math.round(value * 9 / 5) * 5 - 800).intValue()}</Val><Exp>1</Exp><Unit>dB</Unit></Lvl></Volume></${getZone()}></YAMAHA_AV>")

    sendCommand("<YAMAHA_AV cmd=\"PUT\"><${getZone()}><Volume><Lvl><Val>${(Math.round(value * 5 / 5) * 5 - 800).intValue()}</Val><Exp>1</Exp><Unit>dB</Unit></Lvl></Volume></${getZone()}></YAMAHA_AV>")
    sendEvent(name: "volume", value: value)
}

(cjcharles) #81

Just wanted to say thanks so much for this! I have just added it to SmartThings and it is working like a charm! Very happy with it all!

I added a few of the following lines to my Device Handler (below refresh()) in order to pick a chosen radio station from my list. The example below chooses the radio station 4th in my list.

def NetRadioStation3() {
  sendCommand("<YAMAHA_AV cmd=\"PUT\"><NET_RADIO><List_Control><Direct_Sel>Line_4</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>")
}

I then added a Tile to trigger it and gave it a name there

standardTile("netradio3", "device.NetRadioStation3", decoration: "flat", width: 2, height: 2) {
  state "default", label:"Kiss Radio", action:"NetRadioStation3", icon:"https://raw.githubusercontent.com/redloro/smartthings/master/images/indicator-dot-gray.png", backgroundColor:"#ffffff"
}

I know this has been hard coded (not built to be flexible), but I figured nobody else would want my chosen radio stations and it is easy to add and customise for others (plus not many people use the radio!!)