| 
    
     | 
       
        | Author |  |  
        | smarty Super User
 
  
  
 Joined: May 21 2006
 Location: United States
 Online Status: Offline
 Posts: 729
 | 
          Background - I am using PH to telnet into my Wireless Access Points (WAP's) to do a numbers of possible things (reboot them, see if my [or the wife's] I-phone is on my SSID, etc.).  I do this by using a plugin that is defined below:
           | Posted: October 10 2015 at 18:23 | IP Logged |   |  
           | 
 |  
 Plugin Setup
 
 Load Order:10    ID:WAP   IPhone    Type:ActiveX      Launch Data: PH_Socket.phsocket    Init Data:192.168.0.51 23
 
 
 From this working plugin, I define a "Generic Plugin" type trigger, (Any Command, Any Option).  The temp variables (temp5) give me my WAP's feedback.
 
 I presently have my WAP set up to accept a telnet session for an unlimited amount of time (rather than 1,5,10 minutes that are the other possible choices).  While I could keep an active telnet session always open, I would rather open the session, do/get what I need, and then close the session from within PH.  Below is how I login/open the session:
 
 Login Name:
 ph_picmd(5,"WAP IPHONE",1,0,0,"loginname" + char(013),"")
 
 Password:
 ph_picmd(5,"WAP IPHONE",1,0,0,"password" + char(013),"")
 
 Getting WAP clients
 ph_picmd(5,"WAP IPHONE",1,0,0,"get clientinfo" + char(013),"")
 
 Exiting the telnet Session with the WAP
 ph_picmd(5,"WAP IPHONE",1,0,0,"exit" + char(013),"")
 
 
 However, my question/issue comes about when trying to start another telnet session.  It seems that if I reinit the plugin
 
 ph_pictrl("WAP IPHONE","reinit",0)
 
 I CAN log back into the WAP once again.  However, if you exit once again with
 
 ph_picmd(5,"WAP IPHONE",1,0,0,"exit" + char(013),"")
 
 Another ph_pictrl("WAP IPHONE","reinit",0) will cause PH to hard lock and have to be restarted.
 
 SO, my first re-init works (allows me to log back into WAP), but a second re-init will cause PH to hard lock.
 
 Is there a better way to do this?  I have tried disabling and re-enabling the plugin
 
 ph_pictrl("WAP IPHONE","enable",0)
 ph_pictrl("WAP IPHONE","disable",0)
 
 But have come up with the same results.
 
 Update: I get the same PH lock up when I try to use a wait command between the login and password lines:
 10  ph_picmd(5,"WAP IPHONE",1,0,0,"loginname" + char(013),"")
 20 wait 3
 30 ph_picmd(5,"WAP IPHONE",1,0,0,"password" + char(013),"")
 
 If I do it manually, it works.
 
 Edited by smarty - October 10 2015 at 18:46
 
 __________________
 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
 | 
          Steve,
           | Posted: October 11 2015 at 15:08 | IP Logged |   |  
           | 
 |  
 What version of the socket plugin are you using (Help-
 >About->Plugins)?
 
 Once I know the version, I'll trace and see if I can
 find what is going on.
 
 Dave.
 
 |  
        | Back to Top |       |  
        |  |  
        | smarty Super User
 
  
  
 Joined: May 21 2006
 Location: United States
 Online Status: Offline
 Posts: 729
 | 
          Plugin is:
           | Posted: October 11 2015 at 18:45 | IP Logged |   |  
           | 
 |  
 PowerHome Raw Socket Plugin
 PowerHome Plugin ID: WAP IPHONE
 Plugin Version: 1.9
 SDK Version: 1.2
 Current Status: Enabled.
 
 Currently running this only on my developmental PC (Win7, 32 bit; running PH 2.1.5c  (ver 2.1.5.d is running on production machine).
 
 __________________
 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
 | 
          Steve,
           | Posted: October 11 2015 at 19:31 | IP Logged |   |  
           | 
 |  
 Gotcha. I'll start digging into the code to see what
 the problem may be and if I can replicate the
 behavior.
 
 In the meantime, Ive got a couple of suggestions that
 may help eliminate the problem.
 
 1. Leave the Init Data field blank for the plugin.
 Since you're wanting to connect, run some commands,
 disconnect, you don't want to supply this data. If
 supplied, the plugin will automatically connect to the
 IP and port when the plugin is launched.
 
 2. Use the functions like this:
 
 ph_picmd(5,"WAP IPHONE",2,23,0,"192.168.0.51","")
 
 This command should be first and will open the
 connection. Then you can use your other commands as
 normal:
 
 ph_picmd(5,"WAP IPHONE",1,0,0,"loginname" +
 char(013),"")
 ph_picmd(5,"WAP IPHONE",1,0,0,"password" +
 char(013),"")
 ph_picmd(5,"WAP IPHONE",1,0,0,"get clientinfo" +
 char(013),"")
 ph_picmd(5,"WAP IPHONE",1,0,0,"exit" + char(013),"")
 
 When you're ready to disconnect, then use this
 command:
 
 ph_picmd(5,"WAP IPHONE",3,0,0,"","")
 
 This function will actually disconnect and close the
 socket. When you're ready to run again, just repeat.
 
 You may still end up having the issue with it hanging
 though. There was an issue discovered with the current
 plugin framework with threading that causes the
 hanging issue. The problem has been corrected but
 won't be available until the next release.
 
 Let me know how the above goes.
 
 Dave.
 
 |  
        | Back to Top |       |  
        |  |  
        | smarty Super User
 
  
  
 Joined: May 21 2006
 Location: United States
 Online Status: Offline
 Posts: 729
 | 
          Still see some hangs...too flakey for my production machine.  Hopefully the threading fix will lead to increased stability of the plugin.
           | Posted: October 17 2015 at 16:17 | IP Logged |   |  
           | 
 |  
 Edited by smarty - October 17 2015 at 16:18
 
 __________________
 Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
 |  
        | Back to Top |     |  
        |  |  |  |