Problems with input from Onkyo Receiver

Posted on
Thu Nov 14, 2013 9:19 pm
vtmikel offline
Posts: 646
Joined: Aug 31, 2012
Location: Boston, MA

Problems with input from Onkyo Receiver

Hi Perry and Community,

I'm having trouble with a Onkyo Receiver matching input. I can send commands perfectly via the plugin. I verified that the status command I am sending is responded by the receiver. My regex expression is not matching, no matter what I try.

I'm sending: !1PWRQSTN and expect back !1PWR00 or !1PWR01

My regex expressions I'm using: !1PWR(\d+)

I turned on debugging and the asyn.scan module. Here is my event log:
Action Group Ask Receiver Status
Cynical Network scanning '!1PWR01\x1a!1PWR01\x1a!1PWR01\x1a!1PWR01\x1a!1PWR01\x1a'
Cynical Network trying <RE('(.*PWR.*)\\r?\\n')0> <IOM+ 418739177=Save Receiver Status>
Cynical Network trying <RE('(.*?)\\r?\\n')0> _UNRECOGNIZED
Cynical Network no match


Any thoughts on how I can get this to work?

Posted on
Tue Nov 26, 2013 5:39 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

Re: Problems with input from Onkyo Receiver

Cynical Network scanning '!1PWR01\x1a!1PWR01\x1a!1PWR01\x1a!1PWR01\x1a!1PWR01\x1a'
Cynical Network trying <RE('(.*PWR.*)\\r?\\n')0> <IOM+ 418739177=Save Receiver Status>
Cynical Network trying <RE('(.*?)\\r?\\n')0> _UNRECOGNIZED

It looks like the Onkyo command protocol terminates reply lines with the "EOF" (0x1a) character, rather than with the usual CR or NL characters. The plugin is looking for your pattern terminated by a CR character, and that never comes.

That's an odd choice on Onkyo's part. To deal with it, you need to set the line ending to "none" and handle line endings explicitly for both sent and received strings. When sending, be sure to end every command with \r. When scanning for input, end each pattern with \x1a, so for example look for !PWR(\d+)\x1a.

(I should note that according to this trace, your regular expression is actually just plain "PWR". Double-check that you've got the expressions you think you have.)

Cheers
-- perry

Posted on
Wed Nov 27, 2013 9:43 am
vtmikel offline
Posts: 646
Joined: Aug 31, 2012
Location: Boston, MA

Re: Problems with input from Onkyo Receiver

Thanks Perry, this seems to generally be working for both the send and

Small thing I encountered - Since, as you suggested, I must manually handle endings for every send and receive, I thought it would be smart to place my custom endings in a variable and use your plugin formulas. However, something doesn't seem to be working. For example:

Send text (WORKS): !1PWR01\x0D

Send text (DOESNT WORK): ='!1PWR01\x0D'

Send text (DOESNT WORK): ='!1PWR01' + onkyoLE

Is this a python thing, with the handling of "\"?

Posted on
Wed Nov 27, 2013 2:11 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

Re: Problems with input from Onkyo Receiver

Small thing I encountered - Since, as you suggested, I must manually handle endings for every send and receive, I thought it would be smart to place my custom endings in a variable and use your plugin formulas.

That's a good idea, but no good idea stays unpunished. :-)
However, something doesn't seem to be working. For example:

Send text (DOESNT WORK): ='!1PWR01\x0D'

That works fine on my computer (version 1.6.1). Since you're writing Python code, you might as well say \r, but \x0d works as well. (The Onkyo documentation says that either \r or \n or \r\n is accepted as a line ending.)
Send text (DOESNT WORK): ='!1PWR01' + onkyoLE

That's a really good idea, but if onkyoLE is an Indigo variable, you need to be careful what you put there. If you just put the string \x0D into the variable, that really means "a backslash followed by an x…", and doesn't really mean "a carriage return character." As far as I know, there's no UI for putting control characters into an Indigo variable, and so you'd have to do that using Python code.

(How? One way is to use the Perform Script action that all of my plugins have. Make it perform the Python command
Code: Select all
variables.onkyoLE = '\r\n'

(or whichever line ending you prefer), and that's that. You only have to do that once; Indigo stores the control characters in the variable just fine; it just doesn't have UI to put it there.)

Cheers
-- perry

Posted on
Sun Dec 08, 2013 5:03 am
henkjanvries offline
User avatar
Posts: 108
Joined: May 05, 2012

Re: Problems with input from Onkyo Receiver

Hi vtmikel,

im curious how your sending and receiving info from your onkyo. are you using scripts, or do you have a virtual device with the cynical plugin?

hope you can share some light on the matter.

Posted on
Sun Jan 12, 2014 1:33 am
BassMint offline
Posts: 105
Joined: Dec 24, 2013

Re: Problems with input from Onkyo Receiver

henkjanvries wrote:
Hi vtmikel,

im curious how your sending and receiving info from your onkyo. are you using scripts, or do you have a virtual device with the cynical plugin?

hope you can share some light on the matter.


https://github.com/miracle2k/onkyo-eiscp

that is what i am using.

Posted on
Tue Feb 04, 2014 3:05 pm
vtmikel offline
Posts: 646
Joined: Aug 31, 2012
Location: Boston, MA

Re: Problems with input from Onkyo Receiver

I'm using Perry's plugin, sorry for the delay in responding. Let me know if you need help. mikel@mikelamoureux.net

Posted on
Fri Mar 21, 2014 2:30 pm
kyrell offline
Posts: 3
Joined: Mar 21, 2014
Location: Dallas, TX

Re: Problems with input from Onkyo Receiver

Hello! Im new to the forum but not new to Indigo. Years later I am finally trying to do some advanced "stuff" and having all kinds of issues. Stumbled across this thread and hope someone can help.

I am trying to control a Onkyo receiver via the Cynical Network plugin (or Python scripts).
When i add the device, the connection says that its has been made and the light is green.

Cynical Network:
When I add an Action Group that sends text, my event log just shows the Action Group name and my receiver doesn't respond.
I tried all the line ending mentioned above with the same results. Currently i am sending: !1PWR00\x0D

Python:
I did a few python tutorials and decided to go the script route.
On terminal, the scripts work. Within indigo, it tells me that eiscp can not be found. I have found out that i must install the module in the right place but i don't know where that place is nor how to install it :/

I prefer to use the network plugin but help with either would be greatly appreciated!

thx

Posted on
Fri Mar 21, 2014 3:11 pm
BassMint offline
Posts: 105
Joined: Dec 24, 2013

Re: Problems with input from Onkyo Receiver

This is how I have it set up.

in /Library/Python/2.7/site-packages/onkyor.py
Code: Select all
#!/usr/bin/env python
import eiscp

myReceivers = {'club': '192.168.1.202','bar': '192.168.1.203','base': '192.168.1.204','bed': '192.168.1.205'}

def send_command(deviceName, command):
    receiver = eiscp.eISCP(myReceivers[deviceName])
    receiver.command(command)
    receiver.disconnect()


script examples
Code: Select all
#!/usr/bin/env python
import onkyor

onkyor.send_command("club","Volume=30")


Code: Select all
#!/usr/bin/env python
import onkyor

onkyor.send_command("club","volume=level-up")


place the script files folder somewhere, I put mine inside the Indigo folder in Application Support, then call them in Indigo from an Execute Script Action Group.

Initially, I couldn't get responses back into Indigo and I put it aside to resolve in the future as I continue developing other areas in the system I'm putting together.

don't ask how it works as i'm a cut and paste, trial and error jedi kingpin

these are the files I made for my setup.
https://www.dropbox.com/s/3e0a4j3j1kj3iax/onk.zip

Make the onkyor file and set your onkyo ip to 'club'
call them in Indigo from an Execute Script Action Group using the full path to the file.

i.e.: /Library/Application Support/Perceptive Automation/Indigo 6/Scripts/onk/club/onk.club.m.vol.30.py

Club is Main Zone, Booth Is Zone 2. I haven't tested every function, still building and troubleshooting.

Posted on
Fri Mar 21, 2014 5:11 pm
kyrell offline
Posts: 3
Joined: Mar 21, 2014
Location: Dallas, TX

Re: Problems with input from Onkyo Receiver

Same issue. I placed onkyor in site-packages and get the "module can't be found" :(

Code: Select all
Script Error                    616_powerOn.py: No module named onkyor
  Script Error                    Exception Traceback (most recent call shown last):

     616_powerOn.py, line 4, at top level
ImportError: No module named onkyor

Posted on
Fri Mar 21, 2014 7:45 pm
BassMint offline
Posts: 105
Joined: Dec 24, 2013

Re: Problems with input from Onkyo Receiver

kyrell wrote:
Same issue. I placed onkyor in site-packages and get the "module can't be found" :(

Code: Select all
Script Error                    616_powerOn.py: No module named onkyor
  Script Error                    Exception Traceback (most recent call shown last):

     616_powerOn.py, line 4, at top level
ImportError: No module named onkyor


check the permissions of the file

Posted on
Sun Mar 23, 2014 2:22 pm
kyrell offline
Posts: 3
Joined: Mar 21, 2014
Location: Dallas, TX

Re: Problems with input from Onkyo Receiver

BassMint wrote:
kyrell wrote:
Same issue. I placed onkyor in site-packages and get the "module can't be found" :(

Code: Select all
Script Error                    616_powerOn.py: No module named onkyor
  Script Error                    Exception Traceback (most recent call shown last):

     616_powerOn.py, line 4, at top level
ImportError: No module named onkyor


check the permissions of the file


Same thing "No module named onkyor" and currently onkyor.py is '-rwxrwxrwx' in the site-packages folder of Python 2.7.

Has anyone been able to get the Cynical Network plugin to successfully send to an Onkyo receiver?

Posted on
Sun Mar 23, 2014 3:02 pm
vtmikel offline
Posts: 646
Joined: Aug 31, 2012
Location: Boston, MA

Re: Problems with input from Onkyo Receiver

All,

I have my onkyo working fine with Perry's plugin. I use the "no line endings" settings, but append \x0D to each command I send. For instance, I send !1PWR01\x0D to turn the receiver on.

Perry's plugin supports \x0D as a line ending, but sometimes the onkyo behaves strangely on triggers, so I insert it manually.

Hopefully this helps, let me know if I can help any more.

Mike

Posted on
Sun Apr 06, 2014 1:03 pm
colinpartridge offline
Posts: 377
Joined: Jan 13, 2014
Location: London, UK

Re: Problems with input from Onkyo Receiver

kyrell wrote:
Has anyone been able to get the Cynical Network plugin to successfully send to an Onkyo receiver?

I've just hooked up my Onkyo TX-NR616 receiver to Indigo using the Cynical Network Plugin successfully I'm happy to share my settings if you are still not successful.

Colin

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests