Yamaha Network Control Alias Plugin

Today, I?m releasing the files to my Yamaha Network Control Alias (YNCA) plug-in for Vera. I originally attempted to use the Yamaha Network Control (YNC), but ran into a few problems, which eventually lead me to the YNCA.

I started this work about 8 months ago and have been sitting on the working plugin for the past 7. Recently, there have been a number of requests for it. Since my busy schedule has not allowed me to extend it any further, I will be releasing the plugin without a working GUI. I hope that once out, someone else will be able to take the time to make / cleanup the UI.

I?d also like to give credit to richardw and docbliny for providing some inspiration from their receiver control plugins.

The plugin has only been tested on the Yamaha RX-A1000 using the network connection. Only the basic functions such as power, input selection and volume are implemented (System, Main and Zone 2), which should cover 90% of what most people want to do with receiver control. I did implement a little bit of the NetRadio, but only to select a preset (you have to manually create the presets first on the receiver).

Make sure you set the IP in the device properties once installed (I’d set your receiver IP to be static, if you haven’t done so already). Assuming I implemented the serial port correctly, it should work with RS-232 as well (leave the IP address blank in this case).

Given that the YNCA is common across a number of receivers, the plugin should work for the most part on the following receivers (some functions may not be available on all receivers):
RX-A700, RX-A800, RX-A1000, RX-A2000, RX-A3000, RX-V867
RX-A1010, RX-A2010, RX-A3010
RX-V673, RX-A720, RX-V773, HTR-7065, RX-A820, RX-A1020, RX-A2020, RX-A3020

  • Tested, or partially tested receivers are in bold

If a function is missing for your receiver, post the model and function and I?ll see if I can add it. Post if you can confirm it works on one of the models listed, or if you have it working on another model that is not listed above.

The easiest way to use the plugin is to create Scenes, using the Automation > Scenes > Advanced, then adding the receiver and selecting the function. You can build up the scene to, for example turn on the receiver, set the input and set the volume level (in dB).

If someone could get the trac setup (or point me in the right direction), it would be good to start versioning the plugin and add some documentation and model/function compatibility chart, etc. And from there, release it as an app for easy install?


Update: Attached updated files.

Awesome! I uploaded the files to the Vera. Sadly I don’t know what to do next so I’ll quietly watch what everyone else says and learn along side everyone :slight_smile: Glad to see I may be able to control it with everything else soon :slight_smile:

When the time comes that I can actually test something, I’ll make sure to share all of my findings with my specific unit/model.

  1. Assign your IP.
  2. Create a scene.

I’ve attached a sample of my Movie Mode scene, as an example of how to use the plugin. Note that the scene is also controlling my Samsung TV (different plugin).

According to the Yamaha documentation, these is supposed to be a 100ms delay between commands. So far, I haven’t noticed any issue sending commands one after another. As my TV is a little slower in responding, I have a 5 second delay in the scene before sending the next commands.

The MainVol value is in dB.


I take it I need to go to Apps->Develop Apps->Create Device?

Or go to the normal create device screen under devices? Which files do I point it to of the files in the zip (I uploaded them all).

Yes, and use the following:
Device type: urn:schemas-micasaverde-com:device:receiver:1
Upnp Device Filename: D_YamahaReceiver1.xml
Upnp Implementation Filename: I_YamahaReceiver1.xml

Got it . I have added the device and created a scene. I will test it out today/tonight and report on my findings.

Ok. Had a chance to mess around a little with it tonight. This is what I found.

My receiver: Yamaha RX-A3010

[ul][li]There is a delay required for issuing commands right after power on state (I didn’t test multiple commands past it being on though but hitting the scene again did make the additional actions trigger so its probably not so much of a concern to add delay if the unit is already on). I simply created a scene and told it to WoL the PC (turn it on), turn on the main power of the receiver, and switch to AV3 (my PC). PC turned on, receiver turned on…no AV3 (hence the need for a delay there). I hit the scene again and it switched to AV3 (hence why I think delay isn’t an issue after it’s already been powered). I turned it all off, added a 2 second delay to the AV3 command, and it all worked perfectly.(this is fun heh)[/li]
[li]I like how all of the AV and Audio inputs are available. I saw AUX and Dock, but there wasn’t a “NET” input option though so I couldn’t trigger it to turn on straight to Pandora or Sirius online stream. That would be a good option as I could see using that a lot (ie, telling it to turn on the receiver, set the volume and initiate sirius…all when a specific code is entered to unlock the door).[/li]
[li]I love how it grabs all the labels automatically. Looking at the variables it already had the titles named for the inputs I have assigned in the receiver (ie, Xbox, DVD, PC, etc).[/li]
[li]As you can see in the attached image, the device shows the current input in the middle of it’s little window covering a section of the “Off” button. This kind of gets in the way of hitting the off button as the second your mouse rolls over the text, it takes priority over the off button and you have to roll off and quickly back in and click the edge of “off” for the button to work. In the attached image, you can see I had the receiver on AV3…so AV3 was printed there[/li][/ul]

I am really excited. This is nice to be able to start interacting with the receiver now :slight_smile:

[quote=“TheSaint, post:6, topic:174366”]Update:
Ok. Had a chance to mess around a little with it tonight. This is what I found.[/quote]

Thanks for trying it out and providing feedback.

[ul][li]A delay after sending a power command is not surprising. Also, you obviously have to turn the receiver on before issuing any commands. :)[/li]
[li]You’ve found one of the model differences between the 1000 and the 1010 series. They use slightly different commands. I only have the command set for the 1000 and 1020 series. It looks like the missing command is in the 1020 series - I’ll add them on the next update.[/li]
[li]The labels are a nice touch.[/li]
[li]From my original post, the UI needs some work. I haven’t figured that one out yet.[/li][/ul]

Update: Added the NET, SERVER and AirPlay commands. Updated attachment on the original post.

No problem. It’s the least you can do for someone who has dedicated themselves to such a great project.

Thanks for putting this together. I’m trying it out on a RX-V673.

I currently use a Z-Wave GPO to control the power to the AV receiver. So when the power is off I understandably start getting many of these sorts of messages in the log:

luup_log:67: YamahaReceiver: Cannot send command @MAIN:AVAIL=? communications error <0x2ef35680>
luup_log:67: YamahaReceiver: Cannot send command @ZONE2:AVAIL=? communications error <0x2ef35680>

The GUI says “Lua Failure” in red, which is a bit harsh as the power to the AV RX is just off.

Is it possible for your software to make some judgement about whether the device is powered on or not. I imagine this may be problematic as you would have to poll it every couple of minutes or so. Another alternative would be that when I power the AV Rx up or down that at the same time I could notify your software via a service you provide in the plugin. Or perhaps the plugin could just go into standby automatically and just be prodded through a service to wake it up? A further possibility: I could tell the plugin to turn off the power and the plugin would then know the AV RX was off (actually in standby) and then I could totally pull the plug on the AV RX using the Z-Wave control. Not sure how to power all back on and reestablish the comms though. Any ideas on all this?

Now if I could get my Topfield PVR to do a controlled power off via its LAN connection - I would be set! Thanks once again.

A little background on what the plugin is doing in the background and the YNCA protocol requirements.

There are a number of actions on the receiver that provide Auto Feedback via the YNCA protocol, for example, when you hit the power button (or use an IR remote to power state, or change input selection, etc.). This Auto Feedback helps keep the plugin up to date as to the receiver’s current status.

When connecting to the receiver over the network, the Vera is creating a TCP/IP connection. The receiver only leaves the TCP/IP connection open as long as there is activity, otherwise it drops the connection after 40 seconds. Once this connection is dropped, the Vera won’t receive any Auto Feedback messages (and won’t know, for example, that the power state has changed).

In order to keep the connection open, there is a task that repeats every 30 seconds and asks the receiver what model it is and the zone status. Provided the receiver is available on the network, it will always know the status every 30 seconds. I will have to look at error handling the connection not being available in the next release, as these are the requests you are seeing in the logs and creating the “Lua Failure” messages.

In the meantime, the simple solution is for you to make a change to your receiver. In the Network settings, change Network Standby = On. Then your network card will be active even if the receiver is in standby, allowing the connection to occur every 30 seconds. This also allows for the plugin to query the receiver and know if the receiver is On or in Standby. I’ve always had my receiver set this way, as such, I never encountered the errors you did.

Thanks for the feedback!

Hi there dgdev

Thanks for the info on what’s happening in the code. However my unit is turned off, as in unplugged. It’s never in standby. It’s powered on and off by a Z-Wave relay.

Okay. Just trying to wrap my head around this one - are you doing this for energy conservation? If not, you certainly have the option now to use the relay elsewhere and simply issue the On or Standby commands directly.

Yes energy conservation - it doesn’t draw much on standby but all the standbys add up making a substantial amount and cost over a year. It’s not just the AV RX that gets turned off, it’s all the AV gear.

Energy conservation is an interesting area for home control. It’s pretty clear that some people want to run their whole house on just a couple of AA batteries, while other people are happy to pay large power bills. Likewise different people have different views on where the planet is heading. Regardless most people understand money leaving their wallet. I’ve done a bit of work on this and have cut our electricity consumption to the lowest amount we have used in the last sixteen years. Even after doing so, we have just received the most expensive bill we have ever had!!

Based on the cost of power from PSE, my RX-A2010 would cost less than $1 a year to have in standby mode 24/7. Less than the cost of the z-wave power switch.

As far as settings the input, volume, dsp mode, etc. goes, why not use the ‘scenes’ on the receiver itself? Yamaha’s scene function retains those settings and will also power on the unit from standby.

I power on mine by sending “@MAIN:SCENE=Scene 1\r” using luup code. Any scene number of course will work.

It works out to about $4 here, which is neither here nor there. Point is I have the one outlet powering all the AV gear. It would good to be able to set up the plugin so that it’s not too concerned if the target device is powered on or not.

I really like your scene idea by the way.

Hi, just installed it @home and it works perfectly! If do have a question: is it possible to stream a file (MP3 or something similair) to the amplifier? I would like to create an alarm which turns on the amplifier and plays an alarming sound…

Thank you for this plugin!!

[quote=“riochicken, post:16, topic:174366”]Hi, just installed it @home and it works perfectly! If do have a question: is it possible to stream a file (MP3 or something similair) to the amplifier? I would like to create an alarm which turns on the amplifier and plays an alarming sound…

Thank you for this plugin!![/quote]

That would be one over-kill of an alarm clock (unless you can sleep through a fighter jet taking off) :slight_smile:

Unless you mean house alarm in which case you’d be better off with a siren as it can be placed anywhere and will be more annoying to those around thus getting more attention.

Currently I get the following every 30 seconds when the unit is powered up:

06 02/23/13 19:54:16.131 Device_Variable::m_szValue_set device: 67 service: urn:ynca-com:serviceId:Receiver1 variable: ctrl_chr[35;1mModelctrl_chr[0m was: RX-V673 now: RX-V673 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2f5e8680> 06 02/23/13 19:54:16.132 Device_Variable::m_szValue_set device: 67 service: urn:ynca-com:serviceId:Receiver1 variable: ctrl_chr[35;1mMainAvailablectrl_chr[0m was: Ready now: Ready #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2f5e8680> 06 02/23/13 19:54:16.133 Device_Variable::m_szValue_set device: 67 service: urn:ynca-com:serviceId:Receiver1 variable: ctrl_chr[35;1mZone2Availablectrl_chr[0m was: Not Ready now: Not Ready #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2f5e8680> 50 02/23/13 19:54:16.134 luup_log:67: YamahaReceiver: Error: @RESTRICTED The function requested is not supported on this receiver. <0x2f5e8680>

Not to sure how this can be managed - looks like I haven’t got the full set of commands available to me on this device?

I see also the log is logging unchanged variables - I think this is what Richard is alluding to here?:


I may be wrong as I haven’t looked at this in sufficient detail.

[quote=“riochicken, post:16, topic:174366”]Hi, just installed it @home and it works perfectly! If do have a question: is it possible to stream a file (MP3 or something similair) to the amplifier? I would like to create an alarm which turns on the amplifier and plays an alarming sound…

Thank you for this plugin!![/quote]

Riochicken: what receiver model are you using, so I can update the list?

As for the alarm question, the YNCA does not have a method to stream a file. You might be able to do something with network streaming from a media device (if your receiver supports that), but you’re on your own for that one. As @TheSaint suggested, you’re probably better off with an actual siren if your goal is an alarming sound.

You have one of the lower end receivers in terms of functionality, mine’s somewhere in the middle and others have the top end units. Each model level higher adds more functionality, and that becomes the problem. There is a core set of commands that is available on all units, but how do you deal with functions that aren’t available?

I thought about this for some time. Do you create a completely unique plug-in for each receiver? Do you create a separate commands files for each receiver (which means lots of files, currently 17+, which are mostly the same, with slight variations)?

I ultimately decided to add all the functions into one plug-in, and it is up to you, the user, to only use commands that are available on your receiver. If you issue a command that is not supported, the receiver responds with “Restricted”, which is handled by the plugin.

As for the every 30 seconds, getting a restricted message, that’s from the Zone2Available request, as you don’t have a Zone2 on your receiver. I put it in as it’s available on my receiver, and the majority of the models, and I have no way of knowing if your receiver has that functionality. Technically, I could have added up to Zone4. Does if negatively affect the performance? I haven’t noticed anything. I’ll think about this some more.

[quote=“a-lurker, post:18, topic:174366”]I see also the log is logging unchanged variables - I think this is what Richard is alluding to here?:


I may be wrong as I haven’t looked at this in sufficient detail.[/quote]

I’ll take a look at not updating unchanged variables. It does beg the question, which uses more resources - updating the variable every time (and creating a log entry), or querying the variable every time, doing a comparison, and then still possibly updating it?