Author Topic: Yamaha Network Control Alias Plugin 2.0  (Read 76944 times)

Offline Tank

  • Sr. Member
  • ****
  • Posts: 322
  • Karma: +11/-7
Yamaha Network Control Alias Plugin 2.0
« on: December 16, 2013, 01:30:05 pm »
I will no longer be maintaining this plugin.  It was a fun little project but I'm moving to a different home automation platform now.

I've been using the YNCA plugin with some success, it works great when used as part of a scene.  The plugin was never really finished and has been worked on by a number of people.  I'm going to continue working on the plugin myself.   This is the first time I'm working on a Vera plugin so please be nice  8) 

Original plugin: http://forum.micasaverde.com/index.php/topic,13735.0.html

I'll keep track of my progress here, please let me know what you think.

Instructions
After installing the plugin a device will automatically be created.  Go to the advanced tab of that device and add IP address of your receiver (I recommend setting a static IP address on your receiver).  You will have basic control from the dashboard.  And can now add actions to your scenes from the 'advanced' tab (see the attached example).  You must have "network standby" enabled for this plugin to work.

12-16-13 - 2.0 Released
-FIXED overlapping dashboard display
-ADDED ability to launch Pandora as an input
-BROKEN volume slider is still broken, this is high priority for me to fix

12-17-13 - 2.1 Released
-ADDED Volume buttons, temporary until I fix the slider
-ADDED Status tab, very buggy WIP

12-19-13 - 2.2 Pending Approval
-FIXED Volume up button on dashboard

12-21-13 - 2.3 Pending Approval
-ADDED Function to prevent updating variables that have not changed, this should clean up the logs a bit (thanks a-lurker and garrettwp)
-ADDED Many new commands that can be used in scenes, more to come

12-23-13 - 2.4 Pending Approval
-ADDED New buttons, new layout for dashboard (screenshot attached)
-I'm attaching the files here for now since the MCV staff will not be approving plugins over the Christmas break

01-05-14 - 2.5 Released
-ADDED HDMI inputs to list of possible triggers
-ADDED Tuner actions to control AM/FM and Preset features
« Last Edit: November 04, 2015, 09:25:12 am by Tank »

Offline silencery

  • Sr. Member
  • ****
  • Posts: 254
  • Karma: +14/-1
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #1 on: December 16, 2013, 05:42:54 pm »
Wow, that's awesome.  I'll check it out.  Thanks for sharing!

Offline Tank

  • Sr. Member
  • ****
  • Posts: 322
  • Karma: +11/-7
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #2 on: December 17, 2013, 01:27:12 pm »
Thanks for checking it out.  I've posted an updated version above.

Offline jullio

  • Jr. Member
  • **
  • Posts: 67
  • Karma: +0/-1
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #3 on: December 18, 2013, 12:53:16 am »

12-17-13 - 2.1 Released
-ADDED Volume buttons, temporary until I fix the slider
-ADDED Status tab, very buggy WIP

Just thought I would give you a tip on the volume control problem.  Looking at your code I noticed a couple of things you need to add.  Primarily it is micasaverde volume control upnp device properties.  Then you must implement it for your device.

You need to add this code to your D_YamahaReceiver1.xml file.
Code: [Select]
<service>
<serviceType>urn:micasaverde-com:service:Volume:1</serviceType>
<serviceId>urn:micasaverde-com:serviceId:Volume1</serviceId>
<SCPDURL>S_Volume1.xml</SCPDURL>
</service>
Then add an action in your S_YamahaReceiver1.xml files.
Code: [Select]
    <stateVariable sendEvents="no">
      <name>VolumeTarget</name>
      <datatype>string</datatype>
    </stateVariable>
 
    <stateVariable sendEvents="yes">
      <name>Volume</name>
      <datatype>string</datatype>
    </stateVariable>
</serviceStateTable>
<actionList>
   <action>
      <name>SetVolumeTarget</name>
      <argumentList>
        <argument>
          <name>newTargetValue</name>
          <direction>in</direction>
        </argument>
      </argumentList>
   </action>

Then you need to put the action SetVolumeTarget in your implementation file. 
Code: [Select]
<action>
    <serviceId>urn:ynca-com:serviceId:Receiver1</serviceId>
    <name>SetVolumeTarget</name>
    <run>
        sendCommand({"MAIN", "VOL", lul_settings.newTargetValue ..".0"})
    </run>
</action>
Then put the slider in your json file
Code: [Select]
{
"ControlGroup": "[yourcontrolgroup here]",
"ControlType": "slider",
"top": "[value here]",
"Display": {
"Service": "urn:micasaverde-com:serviceId:Volume1",
"Variable": "Volume",
"ID": "Volume",
"MinValue": "00",
"MaxValue": "98",
"Top": 30,
"Left": 10,
"Width": 200,
"Height": 20
},
"Command": {
"Service": "urn:ynca-com:serviceId:Receiver1",
"Action": "SetVolumeTarget",
"Parameters": [{
"Name": "newTargetValue",
"ID": "Volume"
}]
}
}

Anyways thought that would give you an example that you could look off of.

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #4 on: December 18, 2013, 01:28:57 am »
I wanted to chime in and say that part of this is wrong. You should use the standard service types as much as possible. For the service id to set the volume it should be this:

Code: [Select]
<action>
<serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
<name>SetVolume</name>
<run>
    sendCommand({"MAIN", "VOL", lul_settings.DesiredVolume ..".0"})
</run>
</action>

I suggest that you look at the Sonos or the Squeezebox plugin for some pointers on the service types for media / av control.

You'll also want to add this to your xml:

Code: [Select]
<service>
    <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
    <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
    <SCPDURL>S_RenderingControl1.xml</SCPDURL>
</service>

- Garrett
« Last Edit: December 18, 2013, 01:30:52 am by garrettwp »

Offline Tank

  • Sr. Member
  • ****
  • Posts: 322
  • Karma: +11/-7
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #5 on: December 18, 2013, 07:10:52 am »
Thank you for the help guys!  The receiver is expecting volume as a dB value between -80 & 16.  Does the mcv volume control provide that?

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #6 on: December 18, 2013, 07:17:05 am »
I would do a conversion from 0 - 100% to the appropriate db value and send that. The RenderingControl.xml also has SetVolumeDB, however I believe most apps would use the SetVolume service id. It is far easier to have 0 - 100% than to know what db value is needed especially for 3rd party app support.

- Garrett

Offline Tank

  • Sr. Member
  • ****
  • Posts: 322
  • Karma: +11/-7
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #7 on: December 18, 2013, 07:22:52 am »
That's what I thought, something like (95*x)/100-80.  But then I also need to round to nearst half.  Can I do the math right in the implementation file?

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #8 on: December 18, 2013, 07:24:36 am »
Yes, you can perform all lua code in the implementation file.

- Garrett

Offline silencery

  • Sr. Member
  • ****
  • Posts: 254
  • Karma: +14/-1
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #9 on: December 18, 2013, 03:12:59 pm »
Just wanted to report back to confirm yes, the volume is a bit buggy in 2.1 (volume up button doesn't respond since only one pixel is clickable), but other than that, it's working well so far.  Already a substantial improvement over the base version.

Thanks!

Offline Tank

  • Sr. Member
  • ****
  • Posts: 322
  • Karma: +11/-7
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #10 on: December 18, 2013, 03:16:34 pm »
Just wanted to report back to confirm yes, the volume is a bit buggy in 2.1 (volume up button doesn't respond since only one pixel is clickable), but other than that, it's working well so far.  Already a substantial improvement over the base version.

Thanks!

Yeah I saw that, it's only an issue on the dashboard.  I'll fix it shortly, and I'm going to add some buttons to change inputs too.

Offline jolerius

  • Full Member
  • ***
  • Posts: 102
  • Karma: +0/-0
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #11 on: December 18, 2013, 11:34:07 pm »
I got a yamaha RX-V771 and this works fine for me.

But i can't i any way change input on the reciever?

Is it possible to get this to work even on mobile apps such as AuthomationHD, Vera Mobile etc?

Offline Cor

  • Hero Member
  • *****
  • Posts: 1217
  • Karma: +8/-4
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #12 on: December 19, 2013, 03:49:14 am »
Awesome!


Would it be possible to have the option in a scene>advanced and than have someting like a "save settings"   and "reset settings"  linke in the sonos plugin.

I use the Yamaha reciever together with a sonos connect and for my "security system", doorbell for example plays a "dingdong"-sound via the sonos connect , this first saves the settings , play the sound and than reset to the previous settings.   When I am for example watching a movie ,the Yamaha switches to AV1, a specific volume. But I manually have to go back to what I am listening at the moment.


Thanks,
Cor

Offline Tank

  • Sr. Member
  • ****
  • Posts: 322
  • Karma: +11/-7
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #13 on: December 19, 2013, 07:14:51 am »
I got a yamaha RX-V771 and this works fine for me.

But i can't i any way change input on the reciever?

Is it possible to get this to work even on mobile apps such as AuthomationHD, Vera Mobile etc?

Currently you can change inputs from scenes->advanced.  I'm still working on making it a bit more user friendly.  I think app integration is up to each individual developer.  I'll reach out to them once the plugin is a bit more stable.
« Last Edit: December 19, 2013, 12:49:47 pm by joey52685 »

Offline Tank

  • Sr. Member
  • ****
  • Posts: 322
  • Karma: +11/-7
Re: Yamaha Network Control Alias Plugin 2.0
« Reply #14 on: December 19, 2013, 07:17:56 am »
Awesome!


Would it be possible to have the option in a scene>advanced and than have someting like a "save settings"   and "reset settings"  linke in the sonos plugin.

I use the Yamaha reciever together with a sonos connect and for my "security system", doorbell for example plays a "dingdong"-sound via the sonos connect , this first saves the settings , play the sound and than reset to the previous settings.   When I am for example watching a movie ,the Yamaha switches to AV1, a specific volume. But I manually have to go back to what I am listening at the moment.


Thanks,
Cor

I will look into that.  What settings would you want it to remember? Just volume and input?