Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: VBS Scripting Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Anthony
Newbie
Newbie


Joined: January 01 2010
Location: United States
Online Status: Offline
Posts: 8
Posted: April 02 2011 at 13:27 | IP Logged Quote Anthony

I wrote a VB script that turns on my sprinklers and it runs great in Timed Events. However, it seems as though the script can only be executed within the Power Home environment. I cannot run the script for the sprinklers or the lights from the Windows command prompt. Can you tell me if this is possible and how?

Thanks, Anthony
Back to Top View Anthony's Profile Search for other posts by Anthony
 
Anthony
Newbie
Newbie


Joined: January 01 2010
Location: United States
Online Status: Offline
Posts: 8
Posted: April 18 2011 at 15:08 | IP Logged Quote Anthony

Can anyone help me out with the above question?
Thanks
Back to Top View Anthony's Profile Search for other posts by Anthony
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 18 2011 at 16:44 | IP Logged Quote grif091

I do not know the answer for sure but will see what I can find. Some clarification. Powerhome is running and you want to access Powerhome function from an OS Process that is outside the primary Powerhome Process. Or you want to access Powerhome function when Powerhome is not running?

Another approach would be to send the question to the Support ID for Powerhome.


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: April 18 2011 at 23:11 | IP Logged Quote BeachBum

I use PowerHome Socket Server all the time. You might look into it although I don’t know if it will meet your needs.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
Anthony
Newbie
Newbie


Joined: January 01 2010
Location: United States
Online Status: Offline
Posts: 8
Posted: April 20 2011 at 20:53 | IP Logged Quote Anthony

Thanks for the update. It did not seem that I could just run the vbscript with PH commands from the command line so I started using the PHWMCMD.exe to run external PH commands. I am trying to write a web page for my sprinklers so I can just turn on individual zones. The web page (and I am so not a web programmer) calls an embedded vb script that shells out to another vbscript that runs the command. It is working but I think it is sloppy. I also get activeX warnings.   

<html>
<head>
   <script language="vbscript" runat="server">
        
      Sub btnPorchOn_onclick()
        Set WshShell = CreateObject("WScript.Shell")
        strCmd = "C:\Inetpub\wwwroot\scripts\PH_Porch-ON.vbs"
        'strCmd = "PH_Porch-ON.vbs"
        WshShell.Run(strCmd)
        'set WshShell = Nothing
      End Sub
      
      Sub btnPorchOff_onclick()
        Set WshShell = CreateObject("WScript.Shell")
        strCmd = "C:\Inetpub\wwwroot\scripts\PH_Porch-OFF.vbs"
        WshShell.Run(strCmd)
        'set WshShell = Nothing
      End Sub
      
      Sub btnSpnklrOn(zone)
        Set WshShell = CreateObject("WScript.Shell")
        strCmd = """C:\Program Files\powerhome\PH_EZFlora-SingleZone.vbs""" & "64 " & zone
        'strCmd = "PH_Porch-ON.vbs"
        WshShell.Run(strCmd)
        'set WshShell = Nothing
      End Sub
      
      Sub btnSpnklrOff(zone)
        Set WshShell = CreateObject("WScript.Shell")
        strCmd = """C:\Program Files\powerhome\PH_EZFlora-SingleZone.vbs""" & "65 " & zone
        WshShell.Run(strCmd)
        'set WshShell = Nothing
      End Sub         &nb sp; 

   
    </script>

</head>
<body>
     <table border="1">
           <tr>
         <td >Porch Lights</td>
              <td><input type=button id=btnPorchOn value="On"></td>
              <td><input type=button id=btnPorchOff value="Off"></td>
          </tr>
          <tr>
              <td>Sprinkler Zone #1</td>
              <td><INPUT TYPE=BUTTON OnClick="btnSpnklrOn 0" VALUE="On"></td>
         <td ><INPUT TYPE=BUTTON OnClick="btnSpnklrOff 0" VALUE="Off"></td>
          </tr>
          <tr>
              <td>Sprinkler Zone #2</td>
              <td><INPUT TYPE=BUTTON OnClick="btnSpnklrOn 1" VALUE="On"></td>
         <td ><INPUT TYPE=BUTTON OnClick="btnSpnklrOff 1" VALUE="Off"></td>
          </tr>
          <tr>
              <td>Sprinkler Zone #3</td>
              <td><INPUT TYPE=BUTTON OnClick="btnSpnklrOn 2" VALUE="On"></td>
         <td ><INPUT TYPE=BUTTON OnClick="btnSpnklrOff 2" VALUE="Off"></td>
          </tr>        & nbsp;         & nbsp;         & nbsp;  
          <tr>
              <td>Sprinkler Zone #4</td>
              <td><INPUT TYPE=BUTTON OnClick="btnSpnklrOn 3" VALUE="On"></td>
         <td ><INPUT TYPE=BUTTON OnClick="btnSpnklrOff 3" VALUE="Off"></td>
          </tr>
          <tr>
              <td>Sprinkler Zone #5</td>
              <td><INPUT TYPE=BUTTON OnClick="btnSpnklrOn 4" VALUE="On"></td>
         <td ><INPUT TYPE=BUTTON OnClick="btnSpnklrOff 4" VALUE="Off"></td>
          </tr>
          <tr>
              <td>Sprinkler Zone #6</td>
              <td><INPUT TYPE=BUTTON OnClick="btnSpnklrOn 5" VALUE="On"></td>
         <td ><INPUT TYPE=BUTTON OnClick="btnSpnklrOff 5" VALUE="Off"></td>
          </tr>        & nbsp;         & nbsp;         & nbsp;  
          <tr>
              <td>Sprinkler Zone #7</td>
              <td><INPUT TYPE=BUTTON OnClick="btnSpnklrOn 6" VALUE="On"></td>
         <td ><INPUT TYPE=BUTTON OnClick="btnSpnklrOff 6" VALUE="Off"></td>
          </tr>
          <tr>
              <td>Sprinkler Zone #8</td>
              <td><INPUT TYPE=BUTTON OnClick="btnSpnklrOn 7" VALUE="On"></td>
         <td ><INPUT TYPE=BUTTON OnClick="btnSpnklrOff 7" VALUE="Off"></td>
          </tr>        & nbsp;
         </t able>
</body>
</html>


Below is the actual script.

Set WshShell = WScript.CreateObject("WScript.Shell")
parm1 = """EZ_FLORA_SPRINKLER"""
parm2 = WScript.Arguments(0) 'on=64 off=65
parm3 = WScript.Arguments(1) 'zone1=0 zone8=7
strPath = """C:\Program Files\powerhome\PhWmCmd\phwmcmd.exe"""
strCmd1 = " ph_insteon"
sCommand = strPath & strCmd1 & "(" & parm1 & "," & parm2 & "," & parm3 & ")" & ""
MsgBox sCommand
WshShell.Run sCommand, 1, TRUE


Let me know if you have any advice on a cleaner way to handle this.

Thanks
Anthony
Back to Top View Anthony's Profile Search for other posts by Anthony
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: April 29 2011 at 13:15 | IP Logged Quote dhoward

Anthony,

What I would do is design a Control Center screen with buttons to control your sprinkler zones. Set the actions of the buttons to the appropriate commands for your EZFlora. Once done, the Control Center is automatically available via the PowerHome webserver. No scripting necessary

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
Anthony
Newbie
Newbie


Joined: January 01 2010
Location: United States
Online Status: Offline
Posts: 8
Posted: April 29 2011 at 17:07 | IP Logged Quote Anthony

Dave, Control Center was my first attempt but I could not figure out how to use it. I would get as far as the wizard and the default page but I could not figure out how to add and set up new objects. It seems as though the CC is created dynamicaly. Where do I create buttons and assign formulas? Is there any documentation for Control Center?

Thanks for the reply.
Back to Top View Anthony's Profile Search for other posts by Anthony
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: April 29 2011 at 21:34 | IP Logged Quote BeachBum

Good question…. That is my next venture although I’ve been procrastinating for a long time due to lack of documentation.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum