Author Topic: Need help with getting status from surround receiver with RS232  (Read 9570 times)

0 Members and 1 Guest are viewing this topic.

connectedhome

  • Jr. Member
  • **
  • Posts: 9
  • Karma: 0
    • View Profile
    • Connected Home Inc.
Need help with getting status from surround receiver with RS232
« on: December 27, 2011, 11:23:11 PM »
First of all, I cannot say enough about how awesome this program is.  I was already using Eventghost to control my home theater, but now with voice commands, it is just amazing.  I purchased a MXL AC404 mic, which so far I am happy with.  Of course, I am running into the same issue that everyone expects with an open air microphone.  With my system on at any decent volume, the microphone has a hard time hearing my commands over the TV.  I am trying to achieve a completely handsfree experience, which is why I did not want to go with the amulet remote.  I had the idea that I could have vox commando lower the volume of my sound receiver after it hears my prefix (manually programmed prefix, I am not using prefix mode).  This way, it only needs to recognize the prefix command with the higher volume, and the following commands will be much easier to understand with the volume low.  I can control my receiver with RS232 through Eventghost (and I am assuming this can be done through vox commando as well) and send a command to set a specific volume level.  My receiver also supports providing the status of the volume through RS232.  So here's what I am hoping.....

I would like to have vox commando hear my prefix command (which is temporarily "vox commando", open for suggestions), receive that status of the current volume level of the receiver through RS232, remember that volume level, set my receiver to a specific low volume (example -50db), wait for an accepted command, then set the receiver volume back to the remembered volume level

Example:

"vox commando"
-receive status of volume, ex. -25db
-set volume to -50db
"play xbox"
-xbox macro sent
-set volume back to -25db

The idea is vox commando will lower the volume to listen for the command, then return the volume to where it was.

My receiver is a Pioneer Elite VSX23TXH

request volume status RS232 code : ?V<CR>
set volume to -50db RS232 code : 061VL<CR>
set volume to -25db RS232 code : 111VL<CR>

The fun part for me will be inputing the RS232 code for every volume level, since there is no telling where the volume will be set at before I attempt to send a command

I really hope someone can point me in the right direction.  I really think this will work out well and be a good approach for those of us wanting to use open air microphones.  Thanks

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with getting status from surround receiver with RS232
« Reply #1 on: December 28, 2011, 08:58:29 AM »
Hi C.H.

Welcome to VoxCommando and the forum.  What you want to do should be possible.  It has already been done really, but not with an RS232 controlled receiver.  So my first question is, does the volume absolutely need to be modified on the receiver?  Is it not possible by changing the system volume, or by changing the xbmc volume, or by using full mute?

If you need to do it through the RS232 then I think we may find it is best to rely somewhat on EventGhost for this.  VoxCommando currently only has a plugin for Onkyo via ethernet (since that is what I own).  If someone wants to develop an RS232 plugin for their receiver I will be happy to help of course.  In any case, since we are going to be using eventGhost to control and read the volume of your amp, we might as well get it to do the math as well.

So the way it might work is as follows:

"vox commando"
-Vox tells eventghost it wants to listen for a command
-eventghost asks the amp for current volume
-eventghost stores this value
-eventghost reduces the volume on the amp by however much you want.


"play xbox"
-xbox macro sent (by voxcommando)
-Vox tells eventghost it is finished
-eventghost restores the volume to the value it has stored

this is relatively staightforward and requires two macros in eventghost that I can help you create.

the tricky bit comes when the command you want to issue is to change the volume of the amp.  But we can solve that one after we get the basics working.

can you send me a pared down version of your eventghost tree with commands to get and set the volume please?
« Last Edit: December 28, 2011, 10:15:25 AM by jitterjames »

connectedhome

  • Jr. Member
  • **
  • Posts: 9
  • Karma: 0
    • View Profile
    • Connected Home Inc.
Re: Need help with getting status from surround receiver with RS232
« Reply #2 on: December 28, 2011, 10:42:10 PM »
James,
Thanks for the reply.  I had a feeling that event ghost would probably be needed to handle the RS232 side of things.  I actually already use event ghost to process all of my macros (since I was using event ghost before I discovered vox commando).  I guess the more appropriate thing would have been to ask my question in the event ghost forum, but thank you for offering to help.  If we are going to use Event Ghost for RS232, then I actually know exactly how I want vox commando to handle its side of the process. I just have no idea how to make event ghost store a value it requested from the com port, and then reference that later.  Not really sure what you mean by a pared down version of the event ghost tree, but I guess all I really need is an example of 3 things:

1-how to request information from the receiver (I know the RS232 code to request volume status for my receiver is ?V<CR>)

2-how to store that value

3-how to recall that value in a separate macro and use it to send the appropriate command. Example: if the value is -25db (this will probably actually be in the form of an integer), then send command 111VL<CR>, or if value is -20db, then send command 112VL<CR>, and so on

Oh, and yes, I do need the volume commands to go through the receiver.  I am going to be using vox commando to control my entire system, so when I am playing xbox, watching a bluray, or watching my appletv, I still need voice controlled volume.

Again, thank you so much for offering to help, and I cannot say enough about how amazing this program is.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Need help with getting status from surround receiver with RS232
« Reply #3 on: December 29, 2011, 01:42:40 AM »
Hi James, no idea if it helps, but here is the manual for the receiver RS232 interfaces

http://www.pioneerelectronics.com/StaticFiles/PUSA/Files/Home%20Custom%20Install/SC-25-RS232.pdf

Kalle
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with getting status from surround receiver with RS232
« Reply #4 on: December 29, 2011, 11:28:30 AM »
storing and retreiving variables in eventghost is very easy.

you just need a little python script like the one in this command.  In this case I am storing the system volume because I can't test with RS232.  In general though results are returned (and can be read) using:   eg.result

for more info see this: http://www.eventghost.org/docs/scripting.html

Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1544">
    <Macro Name="store volume" Expanded="True">
        <Action>
            System.ChangeMasterVolumeBy(0.0, 0)
        </Action>
        <Action>
            EventGhost.PythonScript(u'eg.globals.currentVol = eg.result\nprint eg.globals.currentVol')
        </Action>
    </Macro>
</EventGhost>

in order to later use the stored variable later; in (most) commands you can write {eg.globals.currentVol}

now, based on the document that Kalle posted the volume is returned in the format: VOL160<CR+LF> then later we want to send the command
160VL<CR>  (although it won't always be 160 of course)  

this is where it gets tricky since I don't have the ability to test, and I'm not exaclty sure how the cariage returns and linefeeds will work in practice but I think in python and in the serial plugin for EG we use \r and \n to represent CR and LF.  I'm pretty sure that we would actually want to send 160VL\r but I'm not sure what format we will get back.
« Last Edit: December 29, 2011, 11:33:43 AM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with getting status from surround receiver with RS232
« Reply #5 on: December 29, 2011, 11:30:43 AM »
this is the best I could come up with without being able to test anything

Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1544">
    <Folder Name="serial test" Expanded="True">
        <Macro Name="store then mute volume" Expanded="True">
            <Action>
                Serial.Write(u'\n?V\\r')
            </Action>
            <Action>
                Serial.Read(None, 0.0)
            </Action>
            <Action>
                EventGhost.PythonScript(u'eg.globals.currentVol = eg.result\n# the next line i used for testing since the first line does not work for me\n# eg.globals.currentVol ="VOL120\\r\\n"\neg.globals.restoreVol = eg.globals.currentVol[3:6]+"VL\\r"\n\n# print eg.globals.restoreVol\n\n')
            </Action>
            <Action>
                Serial.Write(u'010VL\\r')
            </Action>
        </Macro>
        <Macro Name="restore volume" Expanded="True">
            <Action>
                Serial.Write(u'{eg.globals.restoreVol}')
            </Action>
            <Action>
                EventGhost.ShowOSD(u'volume restored to: {eg.globals.restoreVol}', u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial', (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, False)
            </Action>
        </Macro>
    </Folder>
</EventGhost>

connectedhome

  • Jr. Member
  • **
  • Posts: 9
  • Karma: 0
    • View Profile
    • Connected Home Inc.
Re: Need help with getting status from surround receiver with RS232
« Reply #6 on: December 30, 2011, 07:52:58 AM »
Thanks again for the help.  I had to add another com port to my HTPC in order to hook up my receiver, so that is on order and on its way.  As soon as it arrives I will give it a shoot and let you know what happens.  It should arrive in a few days.

connectedhome

  • Jr. Member
  • **
  • Posts: 9
  • Karma: 0
    • View Profile
    • Connected Home Inc.
Re: Need help with getting status from surround receiver with RS232
« Reply #7 on: January 07, 2012, 12:04:27 AM »
Ok. I finally got the parts I needed to start giving this a try. I have managed to have event ghost  request the volume status and store it as eg.globals.vol  If i use "print eg.globals.vol" to see the result I get in the logger:

VOL072
VOL072
(blank line)

Obviously the volume number changes based on what it was set to. I am not sure why I am getting the status returned multiple times, but I will work that out with pioneer tech support.

I then made macros to send each volume level. Now what I need to figure out is how to activate those macros based on what the value of eg.globals.vol is.  My originally thinking was I could have vox command trigger a macro when it goes back into standby that would print eg.globals.vol in the logger. I then assumed I could have what was printed trigger a macro. After trying this I now realize that what is printed is not an event and therefore cannot be used to trigger the macros.   So I know there is a way to accomplish what I need, I just have no clue what that is.

On a less important note, but probably easier to answer, I also cannot seem to figure out how to have vox commando tell event ghost that it has entered standby mode.

Thanks again for all of your help.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with getting status from surround receiver with RS232
« Reply #8 on: January 07, 2012, 09:12:59 AM »
On a less important note, but probably easier to answer, I also cannot seem to figure out how to have vox commando tell event ghost that it has entered standby mode.

Thanks again for all of your help.

Create a VC command that send an event to EventGhost like this:

EG  inStandby

test that, it should show up in EventGhost's log.

When VC goes into standby it generates its own internal event.  Just drag this event from the VC history window on to your new command.

*eventGhost needs to have the broadcaster plugin installed and the settings should match.
http://voxcommando.com/mediawiki/index.php?title=EventGhost

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with getting status from surround receiver with RS232
« Reply #9 on: January 07, 2012, 09:18:42 AM »

I then made macros to send each volume level. Now what I need to figure out is how to activate those macros based on what the value of eg.globals.vol is.  My originally thinking was I could have vox command trigger a macro when it goes back into standby that would print eg.globals.vol in the logger. I then assumed I could have what was printed trigger a macro. After trying this I now realize that what is printed is not an event and therefore cannot be used to trigger the macros.   So I know there is a way to accomplish what I need, I just have no clue what that is.
I think you should use the event which is broadcast from VoxCommando to trigger the "restore volume" macro.  Simple.

connectedhome

  • Jr. Member
  • **
  • Posts: 9
  • Karma: 0
    • View Profile
    • Connected Home Inc.
Re: Need help with getting status from surround receiver with RS232
« Reply #10 on: January 07, 2012, 11:31:40 AM »
James,
It probably is really simple, but I'm afraid im a bit lost. The command that event ghost will send back to the receiver well vary based on the variable eg.globals.vol.

Ex.

If eg.globals.vol = VOL088 then the command event ghost needs to send is 088VL\r

or

If eg.globals.vol = VOL096 then the command event ghost needs to send is 096VL\r


And so on covering all volume levels between 072 and 185

I have all ready created a macro for each volume command with the serial port action write data, I just need to trigger these macros after event ghost enters standby mode, based on the value of eg.globals.vol

I really appreciate your help and I am sorry if you have already answered this I simply have not realized it


jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with getting status from surround receiver with RS232
« Reply #11 on: January 07, 2012, 11:54:03 AM »
do you want me to help you with teamviewer?

http://www.teamviewer.com

It is free and you don't even need to install it.

You don't need to create a separate command for each volume level!  That is the purpose of the variable.  You just store the original volume level and then use it later to restore the volume.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with getting status from surround receiver with RS232
« Reply #12 on: January 07, 2012, 11:58:15 AM »
and yes, I did give you the answer. You need to copy and paste the code above into your eventGhost tree.  Then you just need to wire up the events to the two macros I gave you.

and I was not able to test it since I don't have a serial receiver but I think it is correct, or very close.

connectedhome

  • Jr. Member
  • **
  • Posts: 9
  • Karma: 0
    • View Profile
    • Connected Home Inc.
Re: Need help with getting status from surround receiver with RS232
« Reply #13 on: January 07, 2012, 12:46:00 PM »
you are the freaking man and I am a moron!  Your code works perfect, I just wasnt sure what to do with it before hand.  Now just have to get with Pioneer to see why the receiver is returning multiple volume levels on a status request.  Anyways, thank you so much.  Best product support ever!  oh and I still need to know how to get vox to send eventghost a command when it goes into standby.   I get an error when I use event vc.standby with an eventghost action.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with getting status from surround receiver with RS232
« Reply #14 on: January 07, 2012, 01:22:25 PM »
-did you set up the eventghost plugin called broadcaster?

-which program is generating the error?

-what does the error say?

-what exactly do you mean when you write "use event vc.standby with an eventghost action."?

...

Import the attached group into VC and restart VC.

If you have set up the broadcaster settings correctly as per the wiki it should work.