OnkyoISCP plugin

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

Re: OnkyoISCP plugin

Postby abraxxa » Fri Apr 13, 2012 7:10 am

Sending is different than receiving.
So does everything work for you now?
abraxxa
Experienced User
 
Posts: 78
Joined: Wed Dec 22, 2010 9:10 pm

Re: OnkyoISCP plugin

Postby blaher » Sat Apr 14, 2012 2:30 am

No, I've never been able to send, but the receive codes are showing up properly now. There's one issue with them though: the event it triggers, eg. OnkyoISCP.SLI '01' loses the variable '01', (presumably because of the space), when you drag it from the event log to the configuration tree; it shows up as: OnkyoISCP.SLI

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

Re: OnkyoISCP plugin

Postby abraxxa » Sat Apr 14, 2012 6:58 am

That's the design of Eventghost, events have names and a payload.
Sem;colon decided to split the message into code and number but you can easily disable this in the receiving code.
What are you doing with the received events? I haven't found a use case for them.
abraxxa
Experienced User
 
Posts: 78
Joined: Wed Dec 22, 2010 9:10 pm

Re: OnkyoISCP plugin

Postby blaher » Sun Apr 15, 2012 12:12 am

I was using an event of OnkyoISCP.SLI01 with Sem;colon's to trigger a volume change to 45, because my cable TV box is too loud at the default volume of 50 which I use for everything else. I can't at the moment though because no matter which input, eg. SLI01, SLI02, only OnkyoISCP.SLI is available. Every other event has no spaces, or a '.' instead.

I also use the received events to dim my monitor when a non-pc input is selected.

Cheers

Edit: I found out if you drag the event it drops everything after the space, but if you copy and paste, it keeps it. It doesn't seem to want to report any events since I've upgraded to EG r1568 though, so I've gone back to 0.06 which works for event reception. Arg.
blaher
Experienced User
 
Posts: 152
Joined: Thu Nov 17, 2011 1:27 am

Re: OnkyoISCP plugin

Postby abraxxa » Sun Apr 15, 2012 1:57 pm

It was sem;colons idea to split the received message into message type and payload (which input for SLI events, the volumn for MVL events and so on).
Do you think its better to not split at all or maybe both: trigger and event for the type of event e.g. SLI, MVL and additionally one for the exact message e.g. SLI01, MVL2D.
That would enable to react both on a type of event and an exact event type + value.
abraxxa
Experienced User
 
Posts: 78
Joined: Wed Dec 22, 2010 9:10 pm

Re: OnkyoISCP plugin

Postby blaher » Mon Apr 16, 2012 12:41 am

I realised why it wasn't working to receive events after I upgraded to the latest EventGhost, obviously it overwrote your latest one with an older version! /facepalm

I reloaded 8357639 and surprise, surprise it's receiving events again. :)

I think the best options are not to split it at all, or use a '.', eg. SLI.02, MVL.2D. As far as I understand it, this allows for triggering an event type, if you just use SLI, or a more specific event of SLI.02.

Even though copying and pasting OnkyoISCP.SLI '02', instead of dragging, does get the value to show up in the EventGhost configuration tree, it doesn't actually work to trigger a macro.

Cheers

Edit: I found another page with some code for the Vera plugin, which works for me. It looks very similar to me, but maybe there's some nuances you can see:
http://forum.micasaverde.com/index.php/ ... l#msg67921

0x49 0x53 0x43 0x50 0x0 0x0 0x0 0x10 0x0 0x0 0x0 0x8 0x1 0x0 0x0 0x0 0x21 0x31 0x4d 0x56 0x4c 0x33 0x31 0xd (ISCP############!1MVL31\r) <0x9c13>

& here's a Wireshark capture of EG sending MVL31 too:
char peer1_0[] = {
0x49, 0x53, 0x43, 0x50, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x00, 0x21, 0x31, 0x4d, 0x56, 0x4c, 0x33, 0x31, 0x0d };

viewtopic.php?f=10&t=2964&start=15#p21377 I compared similar things here and once more the 0x08 (which works for Oyremote & Vera), instead of 0x06 has shown up. Is this number the header size? Or am I way off?
Attachments
vera.txt
Vera code
(13.58 KiB) Downloaded 63 times
blaher
Experienced User
 
Posts: 152
Joined: Thu Nov 17, 2011 1:27 am

Re: OnkyoISCP plugin

Postby blaher » Mon Apr 16, 2012 7:22 am

Success! I changed your variable 'code' to 0x08 at line 132 and it works.

line = "ISCP\x00\x00\x00\x10\x00\x00\x00" + "\x08" + "\x01\x00\x00\x00!1" + Command + "\x0D"

I don't know how to calculate the correct variable, but it looks like as mentioned here:
viewtopic.php?f=10&t=2964&start=30#p21476

// the official ISCP docs say this is supposed to be just the data size (eiscpDataSize)
// ** BUT **
// It only works if you send the size of the entire Message size (eiscpMsgSize)

might have something to do with it.

Edit: More success! :D
I changed the variable 'code' to "\x10" and now I can send the command MVLDOWN, which I couldn't even via the webpage, or via Oyremote; as well as all the shorter commands like MVLUP, PWR01, etc.
blaher
Experienced User
 
Posts: 152
Joined: Thu Nov 17, 2011 1:27 am

Re: OnkyoISCP plugin

Postby abraxxa » Mon Apr 16, 2012 4:51 pm

I've implemented my idea of triggering two events per received message:
  • one as sem;colon intended having just the command as eventname and the parameter als payload (on which EventGhost can't trigger actions)
  • and additionally one with the eventname and parameter joined as received by the ISCP protocol

So you have problems sending commands too? I thought only the receiving code sem;colon added wasn't working for you?!
abraxxa
Experienced User
 
Posts: 78
Joined: Wed Dec 22, 2010 9:10 pm

Re: OnkyoISCP plugin

Postby blaher » Tue Apr 17, 2012 12:18 am

abraxxa wrote:So you have problems sending commands too? I thought only the receiving code sem;colon added wasn't working for you?!


I've never been able to send a working code. I had to resort to my http workaround...until now. Sem;colon's version has always worked for reception, and yours does now too; now that one of the events has no spaces, just like Sem;colon's.

On line 135, (I used notepad ++ to get line numbers) I added "\x10" instead of 'code'. I've attached the working __init__.py. Does it work for you? Can you send MVLDOWN with your current version, or the attached one?

Cheers
Attachments
x10.zip
(1.95 KiB) Downloaded 73 times
blaher
Experienced User
 
Posts: 152
Joined: Thu Nov 17, 2011 1:27 am

Re: OnkyoISCP plugin

Postby abraxxa » Tue Apr 17, 2012 7:58 pm

Guessing doesn't help!
I've changed the sending code to also properly use pack.
It seems the ISCP protocol differs quite a lot between models. The Java eISCP code contains a comment that the datasize in the header needs to include the headersize which wasn't needed for my Onkyo PR-SC5507, but it also works for me when I do so I've changed that, should work for you too now.
abraxxa
Experienced User
 
Posts: 78
Joined: Wed Dec 22, 2010 9:10 pm

Re: OnkyoISCP plugin

Postby blaher » Wed Apr 18, 2012 2:20 am

abraxxa wrote:Guessing doesn't help!

It did for me, but I know what you mean. :)

I've changed the sending code to also properly use pack.
It seems the ISCP protocol differs quite a lot between models. The Java eISCP code contains a comment that the datasize in the header needs to include the headersize which wasn't needed for my Onkyo PR-SC5507, but it also works for me when I do so I've changed that, should work for you too now.


It does indeed. Thanks for all your help. Both the sending and receiving seem to work flawlessly now.

I forgot to mention another way I use the receiving events is to trigger either HDMI or S/PDIF. If SLI02 is received it opens up my Windows audio properties and selects HDMI, but if it receives SLI20, it chooses S/PDIF instead.

It's so cool not having to rely on the line of sight of infrared and the automatic triggering.

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

Re: OnkyoISCP plugin

Postby abraxxa » Wed Apr 18, 2012 6:47 am

Great!
I'll release it today so it can be included in the next EventGhost build.
abraxxa
Experienced User
 
Posts: 78
Joined: Wed Dec 22, 2010 9:10 pm

Re: OnkyoISCP plugin

Postby Sem;colon » Wed Apr 18, 2012 6:26 pm

Hey, cool that you guys fixed the issue! :D

Just to get this strait, my intention was to just print volume-levels (and later maybe the title of internet-radio tracks and stuff) as payload, because I don't think that anyone uses something like "MVL50" to trigger an event.. I use it for example to print the actual volume in a variable to show it than on my web-interface, which is very unhandy if you have an extra event for every volume-status. :)
All of the "small" events don't need a payload...

@abraxxa: I looked at your code, nice work!
really, much better written than mine! :lol:
Sem;colon
 
Posts: 29
Joined: Sat Feb 18, 2012 10:51 am

Re: OnkyoISCP plugin

Postby abraxxa » Sun Apr 22, 2012 9:01 am

I've released it as version 0.06, hope it gets included in the next EventGhost build.
abraxxa
Experienced User
 
Posts: 78
Joined: Wed Dec 22, 2010 9:10 pm

Re: OnkyoISCP plugin

Postby blaher » Mon Apr 23, 2012 2:36 am

Excellent, thanks again for all your work on writing the plug-in. I've been using it very successfully.
blaher
Experienced User
 
Posts: 152
Joined: Thu Nov 17, 2011 1:27 am

PreviousNext

Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 0 guests

cron