| Author | 
         | 
          
      
        
         
         smarty Super User 
          
  
  Joined: May 21 2006 Location: United States
 Online Status: Offline Posts: 729
          | 
        
         
          
           | Posted: June 16 2020 at 11:27 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
I presently control my Onkyo AVR's through serial 
 control (either via a Global Cache or via direct 
 serial connection).  With more and more appliances 
 having wired/wireless ethernet connectivity, I am 
 starting to play around with looking into how to 
 control my receivers over wired/wireless ethernet via 
 PH.
 
 For my Sony XBR tv's, IP control was accomplished with 
 Dave's help here: 
 http://www.power-home.com/forum/forum_posts.asp?
 TID=10783&KW=socket
 
 I have been looking into the same approach for my 
 Onkyo recievers.
 
 The Onkyo reciever eISCP ("e"thernet Integrated Serial 
 Control Protocal) messaging is slightly different than 
 the direct serial protocal messaging (ISCP).
 Onkyo protocal documentation is attached here:  
 
 From my web searching and testing with the "Packet 
 Sender" utility (found here: https://packetsender.com/ 
 ), I can make my Onkyo receiver turn on/off, change 
 volume, mute etc....
 
 The Packet Sender strings look like:(in ASCII)
 PowerOn:ISCP\00\00\00\10\00\00\00\08\01\00\00\00!1PWR0
 1\r
 Power Off 
 :ISCP\00\00\00\10\00\00\00\08\01\00\00\00!1PWR00\r
 Power 
 QSTN:ISCP\00\00\00\10\00\00\00\n\01\00\00\00!1PWRQSTN\
 r
 Vol 20    
 :ISCP\00\00\00\10\00\00\00\08\01\00\00\00!1MVL14\r
 
 The Packet Sender strings look like:(in HEX)
 Power On  :49 53 43 50 00 00 00 10 00 00 00 08 01 00 
 00 00 21 31 50 57 52 30 31 0d
 Power Off :49 53 43 50 00 00 00 10 00 00 00 08 01 00 
 00 00 21 31 50 57 52 30 30 0D
 Power QSTN:49 53 43 50 00 00 00 10 00 00 00 0a 01 00 
 00 00 21 31 50 57 52 51 53 54 4e 0d
 Vol 20    :49 53 43 50 00 00 00 10 00 00 00 08 01 00 
 00 00 21 31 4d 56 4c 31 34 0d
 
 Similiar to what I did with my XBR TV's, I have set up 
 a PH_Socket.phsocket plugin (called ONKYO_SOCKET") to 
 send commands directly to the Onkyo IP address and 
 control port (port 60128 by default). The plugin has 
 the full initialzation data (192.168.0.83 60128).
 
 Like with the XBR tv's, I think it again comes down to 
 how the PH_Socket.phsocket plugin handles special 
 characters (FYI - from the Help:About:Plugins area: 
 Raw Socket Plugin, Plugin Version is 2.4, SDK version 
 is 1.2).
 
 I have tried most every variation that I can guess at:
 ph_picmd(2,"ONKYO_SOCKET",1,0,0,"ISCP0000000000000000~
 n","")
 
 My question likely centers around how the plugin 
 handles (or doesn't handle) special characters.  I 
 also have some uncertainty with respect to 8th and 
 12th characters from the left (has to do with Onkyo's 
 protocal and data field sizes).  Not being a computer 
 engineer/scientist, I am a bit at a disadvanged here. 
 
  16_121355_eISCP.JPG">
  Edited by smarty - June 16 2020 at 12:13
  __________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
         | 
        
       
        | Back to Top | 
         
          
         | 
        
       
       
        |   | 
       
        
         
         smarty Super User 
          
  
  Joined: May 21 2006 Location: United States
 Online Status: Offline Posts: 729
          | 
        
         
          
           | Posted: June 16 2020 at 12:38 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
 
  __________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
         | 
        
       
        | Back to Top | 
         
          
         | 
        
       
       
        |   | 
       
        
         
         dhoward Admin Group 
          
  
  Joined: June 29 2001 Location: United States
 Online Status: Offline Posts: 4447
          | 
        
         
          
           | Posted: June 16 2020 at 20:30 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Steve,
 
 Should be doable as long as you're running the latest version of the ph_socket plugin dated 02/07/2019.
 
 Since you're going to be sending binary characters, you have to use a different command number and escape the binary characters (anything 
 below ASCII 32 or above ASCII 128). Your Power On command would look like this:
 
  ph_picmd(2,"ONKYO_SOCKET",10,0,0,"\x49\x53\x43\x50\x00\x00\x 00\x10\x00\x00\x00\x08\x01\x00\x00\x00\x21\x31\x50\x57\x52\x 30\x31\x0d","")
 
 I didnt have to escape every character but just thought it would be easier to do so. When escaping characters, you start with a "\" and 
 follow with either an "x" and 2 hex digits or 3 decimal digits so a carriage return can be escaped as either \013 or \x0d. The thing to 
 remember is if you're using a command 10 (instead of a 1), you MUST escape the "\" character as either \x5c or \092.
 
 Your initialization data for the plugin should also be changed to: 192.168.0.83 60128 1
 
 The third parameter after the port (1) is a flag telling whether data returned by the socket should be escaped or not. I didnt get a chance 
 to review the protocol to see if it was absolutely necessary but it cant hurt. A value of 0 (or not including the 3rd parameter) means that 
 no returned data will be escaped. This could be a problem if binary data is returned. A value of 1 means to escape characters that fall 
 outside of the range of printable ASCII characters. A value of 2 means to escape ALL returned characters. Returned data that is escaped will 
 always be escaped in the decimal format.
 
 Anyways, hope this helps.
 
 Dave.
 
         | 
        
       
        | Back to Top | 
         
          
          
         | 
        
       
       
        |   | 
       
        
         
         smarty Super User 
          
  
  Joined: May 21 2006 Location: United States
 Online Status: Offline Posts: 729
          | 
        
         
          
           | Posted: June 17 2020 at 14:54 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Thanks Dave, I would have NEVER figured it 
 out...especially the "CMD" of binary "10" after 
 "ONKYO_SOCKET".
 
 PWR01: On command looks like:
 ph_picmd(2,"ONKYO_SOCKET",10,0,0,"\x49\x53\x43\x50\x00
 \x00\x00\x10\x00\x00\x00\x08\x01\x00\x00\x00\x21\x31\x
 50\x57\x52\x30\x31\x0d","")
 
 
 PWR00: Off Command looks like:
 ph_picmd(2,"ONKYO_SOCKET",10,0,0,"\x49\x53\x43\x50\x00
 \x00\x00\x10\x00\x00\x00\x08\x01\x00\x00\x00\x21\x31\x
 50\x57\x52\x30\x30\x0d","")
 
 
 The Plugin Trigger Returns info like:
 temp1= _ONK-SOCKET-TRIG temp2= 0 temp3= 62 temp4= 
 60128 temp5= ISCP\000\000\000\016\000\000\000
 \001\000\000\000!1PWR00\026
  temp6= 27 temp7= ONKYO_SOCKET temp8= 1 temp9= 1 
 temp10= 192.168.0.83
 
 
 
 The PWRQSTN: Power Question is trickier, because the 
 string length is longer, and the data field size 
 changes (note the "\x0a\" character...
 
 ph_picmd(2,"ONKYO_SOCKET",10,0,0,"\x49\x53\x43\x50\x00
 \x00\x00\x10\x00\x00\x00\x0a\x01\x00\x00\x00\x21\x31\x
 50\x57\x52\x51\x53\x54\x4e\x0d","")
 
 MANY MANY thanks again to you Dave!
  __________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
         | 
        
       
        | Back to Top | 
         
          
         | 
        
       
       
        |   | 
       
        
         
         smarty Super User 
          
  
  Joined: May 21 2006 Location: United States
 Online Status: Offline Posts: 729
          | 
        
         
          
           | Posted: June 20 2020 at 13:45 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Dave,
 While I was indeed able to get this working with your 
 help (again - thank you), it got me to thinking that 
 maybe I have somehow/somewhere overlooked where there 
 was instructions for how this PH_Socket.phsocket plugin 
 works and the initialazation options available for it.
 
 The lastest PH "help" file for the socket plugin makes 
 no mention of these options...or did I overlook 
 something?     
  __________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
         | 
        
       
        | Back to Top | 
         
          
         | 
        
       
       
        |   | 
       
        
         
         dhoward Admin Group 
          
  
  Joined: June 29 2001 Location: United States
 Online Status: Offline Posts: 4447
          | 
        
         
          
           | Posted: July 06 2020 at 09:51 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Steve,
 
 Sorry I missed this.
 
 Nope, you didnt overlook anything  . The additional command options and such are new in the current ph_socket plugin and had 
 not been documented yet. I have since updated the latest Help file available in the 2.2 beta3 version with all current 
 functionality.
 
 Hope this helps,
 
 Dave.
 
         | 
        
       
        | Back to Top | 
         
          
          
         | 
        
       
       
        |   |       
      | 
    
   
  |