Jump to content


Photo
- - - - -

premise generic ipsc over tcip plug in?


  • Please log in to reply
25 replies to this topic

#16 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 28 April 2012 - 12:33 PM

I'm having trouble understanding what you created. You're telling the UDS10 driver, located on the Premise PC, to talk to the same Premise PC?

Why not point the UDS10 driver to the IP address and port of your Onkyo receiver?
[Serial Receiver Driver -> TCP UDS10 Driver] -----> [Onkyo]

Confirm the UDS10 establishes a connection (Port IO: Open=True) and then send something, anything, to the Onkyo via the Serial Receiver driver you created. You should see activity on Port Spy and in Wireshark. The best confirmation is, of course, sending the Onkyo a proper command, like increase volume, and getting results.

Edited by 123, 28 April 2012 - 12:34 PM.


#17 bcg27

bcg27

    Cocooner

  • Registered
  • PipPip
  • 13 posts

Posted 28 April 2012 - 02:21 PM

Hm yes it seems to work when I send things directly to the receiver. With the UDS10 pointed at the onkyo I can send discrete power on and off commands.

The reason I wanted to send it to the computer itself is because I found an evenghost plugin that is already setup to send commands and receive feedback from an onkyo receiver over IP. The eventghost plugin needs the command itself as the input then constructs the rest of the ISCP packet. My thought was that I would have premise send eventghost a packet containing the command, for example PWR01 to turn the receiver on, and then use the existing plugin in eventghost to do the rest of the work. To do the discrete commands in premise I sent them in eventghost and then copied the packet data from wireshark into the rs232 command spot in premise.

#18 etc6849

etc6849

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1605 posts
  • Location:Irmo, SC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:X10-RF, Z-Wave, Custom
  • Phone:OBi100/110

Posted 28 April 2012 - 02:42 PM

I never implemented ISCP for the Onkyo 905 receiver. It just seemed to be pointless since the RS232 port on it supports 2-way communications very well. I have used the fake UDS10 several times for many devices and it always works. I have used it on vmccontroller for media center, to communicate with a perl script that parses data from an OBi110, a Sharp LED television, the Elk M1g ethernet expander module, etc...

If I remember correctly, the trick only works with TCP ports? If the device you are trying to access communicates via a UDP port, download the OBi110 module and modify it's perl script. You can use a simple perl script as a UDP to TCP bridge.

Another thing that I think you already realize is that the UDS-10 trick will not start receiving data from the real device until you connect the fake serial port to a serial device object under Devices.CustomDevices in Builder.

Edited by etc6849, 28 April 2012 - 02:42 PM.


#19 bcg27

bcg27

    Cocooner

  • Registered
  • PipPip
  • 13 posts

Posted 28 April 2012 - 03:25 PM

Thanks for the tip etc6849. I would probably use serial except my receiver does not have a serial port, just ethernet.

I wrote a quick script in python to accept a TCP packet and transfer the data into a UDP packet which goes to eventghost. Eventghost is now seeing the udp packets coming over correctly. I can send out on the fake UDS10 PWR01 and eventghost sends the correct eISCP packet to turn the receiver on :D. Now I just need to make a script in eventghost to grab the data out of the udp packet and route it to the onkyo iscp plugin instead of making a separate event for each command.

#20 etc6849

etc6849

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1605 posts
  • Location:Irmo, SC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:X10-RF, Z-Wave, Custom
  • Phone:OBi100/110

Posted 28 April 2012 - 04:05 PM

If the iscp packet is sent using TCP, then Premise can do all of the work without eventghost. You may have to resort to making a serial module in Premise that uses the "Binary Mode" in lieu of Text Mode; it depends on the ISCP protocol and what characters it uses. The W8800RF32 module I built gives an example of how to use binary mode with a serial port in Builder.

#21 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 28 April 2012 - 05:14 PM

Wow! That's quite the Rube Goldberg Machine you've created!

I had a look at EventGhost's Onkyo ISCP plug-in and it's a mere 183 lines of Python. The lion's share of the code is "driver overhead" and the only important work it performs is transmitting properly formed ISCP commands and parsing received ISCP commands. Quite honestly, less than a dozen lines of code do the real work. Unless you are already using EventGhost for other purposes, it's a lot of overhead for a dozen lines of Onkyo code (plus the TCP/UDP script you're running).

The ISCP protocol (see the XLS file here) dictates that commands take this form when transmitted via Ethernet:

ISCP 00000010 00000007 01000000 !1PWR01 0D

Don't take that string literally. You have to convert everything into binary. Here's an example of what I mean taken from the AutoIT forum. It uses AutoIt's scripting language, not VBScript, but you get the idea of what needs to be done in VBScript.

Global $binISCP_Header = StringToBinary("ISCP")
Global $binISCP_HeaderSize = Binary("0x00000010") ; Header size = 16
Global $binISCP_DataSize = Binary("0x00000007") ; Data size (command length) = 7 chars
Global $binISCP_Version = Binary("0x01000000") ; Version 1.0.0.0
Global $binISCP_Data = StringToBinary("!1PWR01"); Command=!1PWR01
Global $binISCP_End = Binary("0x0D") ; @CR

Global $binISCP_Message = $binISCP_Header & $binISCP_HeaderSize & _
$binISCP_DataSize & _
$binISCP_Version & _
$binISCP_Data & _
$binISCP_End

TCPSend($ConnectedSocket, $binISCP_Message) ; Send message over connected socket


Here is the EventGhost plug-in's code for creating an IPSC command:
datasize = self.plugin.headersize + len(message)
line = pack('!4sIIBxxx',
self.plugin.header,
self.plugin.headersize,
datasize,
self.plugin.version
) + message

There's about the same amount of code for parsing a received IPSC command. That's it, that's all! The driver does nothing else (not even periodically poll your receiver to get the latest status and confirm the network connection is functional).



With a little effort you can duplicate the IPSC functionality in your Premise Receiver driver and dramatically reduce the number of components in your Rube Goldberg machine.


Edited by 123, 28 April 2012 - 05:43 PM.


#22 bcg27

bcg27

    Cocooner

  • Registered
  • PipPip
  • 13 posts

Posted 28 April 2012 - 05:33 PM

Heh you are definitely right 123 it is very convoluted and I would like to do it all in Premise, it was a kind of quick way to get everything working since I am rather unfamiliar with vbscript and premise. My GC-100 just came in today too and I am busy putting in IR codes for my TV and DVR. What is the best way to go about putting that script in? Can I intercept the TCP command from the UDS10 or does it have to happen sometime before that?

#23 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 28 April 2012 - 05:43 PM

To help you get started (with making a full-fledged Onkyo Receiver driver), the attached Demo script contains VBScript functions to convert strings to binary and binary to string. Run it from Windows to understand the conversions.

Attached Files

  • Attached File  Demo.zip   354bytes   6 downloads

Edited by 123, 28 April 2012 - 05:45 PM.


#24 bcg27

bcg27

    Cocooner

  • Registered
  • PipPip
  • 13 posts

Posted 06 May 2012 - 11:13 AM

Thanks for the sample code 123. I finally found some time to watch the 2 way serial video tutorial and took a look at the Integra driver. Everything I need to do seems to be pretty straightforward the video was really good. I do have one more question though - is there a sending equivalent of the OnNewData property or do I need to make a separate property change script for every potential type of command?

#25 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 06 May 2012 - 01:15 PM

Referring to the Integra driver, ultimately all outbound commands are transmitted by the Worker object. However, more to your point, you have to prepare an appropriate ISCP command for each driver property. In the Integra driver, the author chose to use a combination of OnChange Property scripts and Command scripts.

#26 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 642 posts
  • Location:Santa Cruz, Ca
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:INSTEON, Z-Wave, RadioRA
  • Audio:Xantech
  • CCTV:ip

Posted 25 May 2012 - 10:59 AM

Thanks 123!!! I have a TIVO module that I have been thinking of letting loose. It works fine with IR and I know how to deal with the quirks. So I thought I'd convert it to use the TCP protocol that TIVO has so generously provided. But, I could not figure out how to do something as simple as send a command from an IP-Based HA Program to an IP controllable device. :blink:

The UDS trick worked. I now have a fully functional TIVO module, sending IP commands instead of IR.

And yes, I've learned... I have both a MB version AND an AB Version.... ^_^




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users