Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: How do I make a simple PSP page Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Guests
Guest
Guest


Joined: October 01 2003
Online Status: Online
Posts: -109
Posted: January 14 2003 at 13:22 | IP Logged Quote Guests

Hi Everyone,

I am evaluating Powerhome, and I was wondering if some kind soul would write me a sample PSP webpage that will turn on a X10 lamp module , Say code F5 (Table Lamp). Two buttons (On) (Off) .

I do have experiance using HTML, and understand that the webpage must be in the c:/program files/powerhome/web folder as index.html

Problem is I don't see any examples of this PSP in the manual.

If I can see an example page that turns on a lamp module (F5) I think I can take it from there. I just need to see how it works.

I would be quite thankfull..

Phil

BTW: Does anyone have on-line a webpage that I see what is possible using PSP ?

Thanks again..

 

 

Back to Top View Guests's Profile Search for other posts by Guests
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 14 2003 at 21:08 | IP Logged Quote TonyNo

Welcome Phil! I just went through what you did.

Start here...

http://www.myx10.com/forum/display_topic_threads.asp?ForumID=1&TopicID=137&PagePosition=1

These are my many notes to Dave about just this! My PSP's are behind a login, but, maybe guest mode would allow something. When my DSL gets reconnected, I'll let you know (hopefully within a week). I have not seen anyone else here post a link (or code) to their PSP pages. Maybe I should start a tutorial and help out Dave!

Tony

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
Guests
Guest
Guest


Joined: October 01 2003
Online Status: Online
Posts: -109
Posted: January 14 2003 at 21:26 | IP Logged Quote Guests

Thanks Tony,

But I think I am even more lost now.

The sample PSP files in the sample folder, come up as Photo Shop file. So I used MS Word to load it as a text file hopeing to see how it works, and now I'm still lost.

Where or how are these PSP files used in Powerhome ?

Is it not possible to just write an HTML page and address Powerhome using commands ?

Guess I don't understand the whole concept of using PSP.

Any suggestions..

Phil

 

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

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 15 2003 at 10:05 | IP Logged Quote dhoward

Phil,

The sample PSP files should just be opened in either notepad or wordpad.  You can open them in Word as a text file but it's overkill.

The easiest way to create a custom page with just a button to turn F5 On is listed below.  The file should be saved to the PowerHome web directory and the sample assumes the filename is "simple.htm".

<html>
<head>
<title>Simple PowerHome X-10 Button</title>
</head>
<body>
<form action="/ph-cgi/execsendkeys" method=post>
<input type="hidden" name="nexturl" value="/simple.htm">
<input type="hidden" name="sendkeys" value="ph_rtne(ph_x10(1,'F',5,0) + ph_x10(1,'F',102,0))">
<input type="submit" value="F5 On">
</form>
</body>
</html>

I won't go into the various HTML tags, but will detail the PowerHome specific calls.  Basically were creating a form with a single button.  The form will call an internal PowerHome CGI function called "execsendkeys".  This function allows the user to pass two parameters...the "nexturl" to be returned when done and the "sendkeys" formula to be executed.  I've declared both these parameters as "hidden" form types.  The "nexturl" tells PowerHome that when the button is clicked, I want to reload the same page.  The "sendkeys" is a formula that I want PowerHome to perform.  In this case, I don't actually want to simulate any keystrokes being pressed so I use the ph_rtne function which will convert numeric data to an empty string.  Inside the ph_rtne function are two ph_x10 functions.  The first one tells PowerHome to send housecode/unitcode "F5" to X-10 controller 1.  The second one tells PowerHome to send housecode/command "F On" to X-10 controller 1.  If the ph_x10 command is successful, it will return a 0.  If both are successful we'll get 0 + 0 = 0.  The ph_rtne will convert the 0 to an empty string which is then passed to the send keys function.  Since the string is empty, no keystrokes will actually be simulated but we don't care since we performed the X-10 functionality that we wanted.  F5 will be turned on and the browser will reload the same page.

In the above example, we didn't use PSP at all and just had a simple HTML page.  We didn't have to use PSP because the page is static, meaning that the way the page is displayed will never change.  Now if we wanted to include the time that "Sunset" will occur on our webpage, then that is dynamic, meaning that the web page is changing based upon some condition.  In this situation, we would use PSP, which is nothing more than HTML with embedded PowerHome formula functions.  These formula functions are enclosed within the "<%" and "%>" tags.  When PowerHome serves a PSP page, the page is searched for the PSP tags, the formulas are evaluated, and the results are passed back along with the HTML.  Below is our simple HTML button for F5 On slightly enhanced with the time that Sunset will occur that day:

<html>
<head>
<title>Simple PowerHome X-10 Button</title>
</head>
<body>
<%string(ph_getsuntime(today(),2))%>
<form action="/ph-cgi/execsendkeys" method=post>
<input type="hidden" name="nexturl" value="/simple.psp">
<input type="hidden" name="sendkeys" value="ph_rtne(ph_x10(1,'F',5,0) + ph_x10(1,'F',102,0))">
<input type="submit" value="F5 On">
</form>
</body>
</html>

All that is different is a simple function that returns the time that sunrise will occur.  To make this work, the file must be named "simple.psp" instead of "simple.htm".  You can also see that I changed the "nexturl" to reflect the new filename.

Hope this helps and let me know if you have any other questions.

Dave.

 

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

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 16 2003 at 09:51 | IP Logged Quote dhoward

Phil,

No problem.  Glad it makes sense now .  If you have any more questions, just let me know.

Good luck,

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 27 2003 at 20:43 | IP Logged Quote TonyNo

I just found out that PSP pages accessed as GUEST are secure. Here is a link to my main PSP page (under constant development)...

http://guest:guest@tonyno.ods.org:8000/qc-frame.psp

Tony

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 28 2003 at 10:26 | IP Logged Quote dhoward

Tony,

Awesome!! I think its great that you've put up your site so all can see and get ideas.

Its also inspired me to make a couple of changes...

1.  When the guest account is denied access, make the button reload the page rather than arbitrarily go to the "Main" page.

2.  On the event log list...come up with a way to reduce the number of pages .  It looks like since you've posted your site, you're getting a ton of events in the log .

Thanks Tony,

Dave.

 

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 28 2003 at 12:50 | IP Logged Quote TonyNo

Thanks, Dave. The changes sound like good ones. All the entries in the log may be from something I'm playing with...

Tony

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
Valence
Newbie
Newbie


Joined: January 23 2003
Online Status: Offline
Posts: 6
Posted: February 11 2003 at 21:50 | IP Logged Quote Valence

So here I am feeling pretty dumb.  Just to get my feet wet with the web browser interfaceI decided to just cut and copy your simple.html page and when I click on the button, It (the browser) goes to page not found error and the address bar in the url tries to go to   "c:\ph-cgi\execsendkeys "  I have put the simple.htm and simple.psp in  the c:\ProgramFiles\PowerHome\web folder .  I have enabled the web server in power home and I have set a master password.  Also it doesnt turn on F5.         Any thoughts. I'm sure its in my configuration somewhere but I dont where.

Patrick

Back to Top View Valence's Profile Search for other posts by Valence
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: February 11 2003 at 22:34 | IP Logged Quote TonyNo

You need to acccess the file through the server. If you are accessing PH from the same computer, use http://localhost/simple.psp (if you have used port 80).

Tony

Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 12 2003 at 11:23 | IP Logged Quote dhoward

Patrick,

Tony is correct!! You must access the system via the webserver and not through the file system.  This means that in the browser you must place your tcp-ip address (localhost in this case which should have an entry in your hosts file to map to 127.0.0.1) along with the page.  So if you were accessing the PowerHome main page, you would type: http://localhost.  If you were using a port other than 80 (such as 8000), then you would also have to include that: http://localhost:8000

This assumes that you are running the browser on the same machine that PowerHome is running on.  If your machine is connected to a network, then you'll have to use the IP of the PowerHome machine (or create an entry in the client machines host file to map to the PowerHome IP).

Let me know if this helps or not.

Dave.

 

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


Joined: January 23 2003
Online Status: Offline
Posts: 6
Posted: February 12 2003 at 12:49 | IP Logged Quote Valence

I knew it was something dumb........... I should have known that

Thanks

Patrick

Back to Top View Valence's Profile Search for other posts by Valence
 

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