Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Questions and comments specific to a particular plugin should go here.
Dragon470
Experienced User
Posts: 201
Joined: Thu Feb 10, 2011 2:16 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Dragon470 » Sun Mar 01, 2015 8:52 pm

I changed the AddActions in the plugin as I had implemented it wrong. It is corrected, but if you use the "Copy As Python" from a previously added action, it will still be wrong.

Any action added with the new version, will work. So if you wanted to do the "Copy As Python" from an older action, just recreate the action and then do the "Copy As Python" from the new one.

I did it this way so it would not break everybody's configuration trees.

Mastiff
Experienced User
Posts: 748
Joined: Thu May 03, 2012 10:43 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Mastiff » Mon Mar 02, 2015 1:24 pm

Yep, that works now, thanks! Took me a few seconds to discover that it changed anything, since I was using pattern 2, but then I saw the 1 at the end of the command... :lol: What I can't understand is GetInfo. I tried this:

Code: Select all

print (eg.plugins.YamahaRX.GetInfo('Level', 'Subwoofer_1'))


I also tried to switch around Level and Subwoofer_1, and I tried to drop Level (which didn't work since it needs more parameters). This is the error message:

Code: Select all

13:52:38      Input not active or unavailable with your model.
13:52:38      None


I'm guessing that my syntax is wrong, I doubt that it's something that isn't available, since the 3067 has that info in the Receiver Manager software. :mrgreen:

Dragon470
Experienced User
Posts: 201
Joined: Thu Feb 10, 2011 2:16 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Dragon470 » Mon Mar 02, 2015 1:30 pm

here is a way to get an individual speaker per-out level.

Code: Select all

speakers = eg.plugins.YamahaRX.GetInfo('PreOut Levels', 'System')
for x in speakers:
    if x[0] == "Subwoofer_1":
        level = x[1]
       
#now variable level carries the correct value
print level

Mastiff
Experienced User
Posts: 748
Joined: Thu May 03, 2012 10:43 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Mastiff » Mon Mar 02, 2015 1:44 pm

Thanks! Works as a charm! :mrgreen: So I guess it's not possible to get it straight out. I was thinking about doing a logic like this to increase the subs:

Code: Select all

NewLevelSubwoofer1 = ({get subwoofer 1 level from the receiver})+1
NewLevelSubwoofer2 = ({get subwoofer 2 level from the receiver})+1
eg.plugins.YamahaRX.SetPattern1([['Subwoofer_1', NewLevelSubwoofer1], [NewLevelSubwoofer2, 4.0]])


But it seems it takes a bit too long to get the level, so I will probably have to do it by getting the level into the variable when I turn on the receiver and then keep that variable and use that with +1 and -1 to adjust, before clearing it when the receiver is turned off.

Btw is it possible to get the receiver to tell when it's being turned off in another way than using a Nexa signal switch connected to a relay on the 12V control output? With a Sony I have in my daughter's room I can get all commands as events in EG. I'm guessing that the Yamaha has to send something like that since it tells both the built in control web page and the app that it's turned off, but maybe the problem is receiving it as an event?

Dragon470
Experienced User
Posts: 201
Joined: Thu Feb 10, 2011 2:16 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Dragon470 » Mon Mar 02, 2015 11:19 pm

The only real way (and the same way the webpage does) is to query the device. I don't really want to continuously query the receivers at a constant interval. Newer sony receivers do it differently as they have 2-way communication with each pc, tablet, phone that connects to its web page. The source of a yamaha receiver says that it updates every 5 seconds. I also know it updates on any button press.

It is possible to do this, but to store everything would be a bit cumbersome. The only nice way to do this would be to grab the whole xml profile at once and then do whole comparisons with consecutive xml grabs. This was an idea a long time ago and I had abandoned it.

Dragon470
Experienced User
Posts: 201
Joined: Thu Feb 10, 2011 2:16 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Dragon470 » Tue Mar 03, 2015 12:25 am

here is an example you could use within your configuration tree

Code: Select all

try:
    Sub1 = eg.globals.Sub1      #checks if global variable has data / sets the local variable
except:     #only happens if eg does not have the data
    speakers = eg.plugins.YamahaRX.GetInfo('PreOut Levels', 'System')
    for x in speakers:
        if x[0] == "Subwoofer_1":
            Sub1 = x[1]
            eg.globals.Sub1 = Sub1      #sets for future use so it doesn't have to poll the receiver again
   
       
#now local variable carries the correct value
#print Sub1

#small condition to prevent error messages
if Sub1 < 9.5:
    eg.plugins.YamahaRX.SetPattern1([['Subwoofer_1', Sub1 + 1]])
    #reset the eg global variable
    eg.globals.Sub1 = Sub1 + 1



Then just for the opposite (lower volume)

Code: Select all

try:
    Sub1 = eg.globals.Sub1      #checks if global variable has data / sets the local variable
except:     #only happens if eg does not have the data
    speakers = eg.plugins.YamahaRX.GetInfo('PreOut Levels', 'System')
    for x in speakers:
        if x[0] == "Subwoofer_1":
            Sub1 = x[1]
            eg.globals.Sub1 = Sub1      #sets for future use so it doesn't have to poll the receiver again
   
       
#now local variable carries the correct value
#print Sub1

#small condition to prevent error messages
if Sub1 > 9.5:
    eg.plugins.YamahaRX.SetPattern1([['Subwoofer_1', Sub1 - 1]])
    #reset the eg global variable
    eg.globals.Sub1 = Sub1 - 1



This will help the speedup and will be maintained until eventghost is open. You could also look at the pvar plugin to extend beyond closing eventghost.

Mastiff
Experienced User
Posts: 748
Joined: Thu May 03, 2012 10:43 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Mastiff » Tue Mar 03, 2015 8:48 am

Thanks! Very nice! :) As for keeping variables I prefer to use the system registry. I have a key for home automation, with temperatures for all rooms, modes and so on (day, night, no-frost), which are all set when a change is made.I have tried using a file before, but had an instance where the computer must have crashed in the middle of a write, and that garbled the file. So since that I've been using the system registry and it has never let me down. :mrgreen:

Mastiff
Experienced User
Posts: 748
Joined: Thu May 03, 2012 10:43 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Mastiff » Tue Mar 03, 2015 9:13 am

This is more general Python: I need to limit the range to -10 to 10 (which are the limits of my receiver). I tried this (after having changed the variables a bit, I have 15" subs on 1 and 12" subs on 2):

Code: Select all

if eg.globals.Subwoofer15 > 10
    eg.globals.Subwoofer15 = 10


I thought that should work, but it didn't. Do you know what's wrong with the syntax there?

krambriw
Plugin Developer
Posts: 2569
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by krambriw » Tue Mar 03, 2015 11:28 am

Code: Select all


if eg.globals.Subwoofer15 > 10:
    eg.globals.Subwoofer15 = 10


My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons

Mastiff
Experienced User
Posts: 748
Joined: Thu May 03, 2012 10:43 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Mastiff » Tue Mar 03, 2015 11:48 am

:oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops:

Thanks! :mrgreen: Still a bit of my head is in LUA...

Dragon470
Experienced User
Posts: 201
Joined: Thu Feb 10, 2011 2:16 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Dragon470 » Thu Mar 05, 2015 8:47 pm

Here is a simple script that could be expanded for a constant monitoring of a yamahaRX.

Code: Select all

#for reference
#item[0] = object
#item[1] = zone/category
#item[2] = value
#item[3] = suffix in TriggerEvent

from threading import Thread
import time


def MYFunction(objects):
    while eg.globals.YamahaRXscan:
        time.sleep(1) #wait time in between checks
        for item in objects:
            temp = eg.plugins.YamahaRX.GetInfo(item[0], item[1])
            if temp != item[2]:
                item[2] = temp
                eg.TriggerEvent(item[3], payload=item[2], prefix="YamahaRX")
    print "Exiting YamahaRXscan"



#initial setups
objects = []
objects.append(["Power", "Main Zone", eg.plugins.YamahaRX.GetInfo('Power', 'Main Zone'), "MZPower"])
objects.append(["Volume Level", "Main Zone", eg.plugins.YamahaRX.GetInfo('Volume Level', 'Main Zone'), "MZVolume"])
objects.append(["Input Selection", "Main Zone", eg.plugins.YamahaRX.GetInfo('Input Selection', 'Main Zone'), "MZInput"])

eg.globals.YamahaRXscan = True
T = Thread(target=MYFunction, args=[objects])
T.start()


Then to stop the thread run:

Code: Select all

eg.globals.YamahaRXscan = False

Mastiff
Experienced User
Posts: 748
Joined: Thu May 03, 2012 10:43 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Mastiff » Fri Mar 06, 2015 8:09 am

Thank you very much! I'm at home now for a week or two, going back to the cabin either next weekend or the one after. I will try that then! :mrgreen:

blaher
Experienced User
Posts: 463
Joined: Thu Nov 17, 2011 1:27 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by blaher » Mon Mar 09, 2015 7:02 am

Hello there,

I'm having trouble changing the inputs on my Yamaha RX-V477. Some of the commands work, as you can see by my screenshots, but not the inputs.

I'm using a Z-Wave Vera which has an HTTP plug-in http://forum.micasaverde.com/index.php?topic=23079.0 which sends 'HDMI1', or 'HDMI2', rather than the renamed source input, and that works, so maybe that is the issue.

It's not a dealbreaker for me, because I can use EventGhost to send a message to the Vera, which in turn runs a scene which will change the inputs, but I thought it might help others if I let you know of the problem.

Here are some screenshots, and Wireshark captures if it helps any:
http://imgur.com/a/8Jmiv

Dragon470
Experienced User
Posts: 201
Joined: Thu Feb 10, 2011 2:16 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Dragon470 » Mon Mar 09, 2015 6:58 pm

I see the issue that you can rename your inputs on the receiver and they even show up in the "get available" action, but can't use them. I will look into the remapping them back to their internal name. Update to come when I have enough time. Thanks for pointing this out, as I don't usually rename any of my inputs.

Dragon470
Experienced User
Posts: 201
Joined: Thu Feb 10, 2011 2:16 am

Re: Yamaha RX-Vxxx (or similar) Ethernet Plugin!

Post by Dragon470 » Tue Mar 10, 2015 2:19 pm

An update is up for the renaming of inputs. I think I covered all actions, but I don't really have time now to check every action that uses sources.

Post Reply