Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Forcing a postback on web page from CC? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
fasttimes
Groupie
Groupie


Joined: March 12 2006
Online Status: Offline
Posts: 63
Posted: April 26 2006 at 03:11 | IP Logged Quote fasttimes

I managed to get my buttons on CC to change color according to state, yet when I use the web page version of CC I have to hit the refresh button in order to see the color change on the web page.


I even added a ph_wcrefresh() at the end of my formula, but that didnt work.

Any suggestions on how to make the postback reflect the current state?

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

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: April 26 2006 at 23:19 | IP Logged Quote dhoward

The only way for the web based Control Center to see the button changes is for it to refresh. You can do this by setting the "type" parameter.

The default "type=1" tells PowerHome to serve the Control Center in a frame and redirect requests to the hidden frame. A "type=2" redirects requests to a pop-under window. What you want to use is "type=3" which tells PowerHome to redirect requests to the main browser window. This will cause a "refresh" and you should see the color changes.

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


Joined: March 12 2006
Online Status: Offline
Posts: 63
Posted: May 01 2006 at 21:36 | IP Logged Quote fasttimes

Dave,


How do I do this? From which page?

Thanks,

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

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: May 01 2006 at 22:49 | IP Logged Quote TonyNo

The CC page link itself.

I think this applies still.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: June 16 2006 at 22:42 | IP Logged Quote smarty

I am trying to have the buttons (which change color and text) on my remote display (webserver):

1) refresh to always show the current state.
2) stay synchronous with the server computer.

I have read this link (and embedded link), and have my
Setup:Web: Control Center URL set to " /ph-cgi/controlcenter?TYPE=3".

This helps with SOME of the button refreshes, but NOT every time (it is not random, I can duplicate this).

What other things should I do to make both the remote and server system stay 100% current and 100% synchronous?
Back to Top View smarty's Profile Search for other posts by smarty
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: June 16 2006 at 23:01 | IP Logged Quote smarty

OK, I have figured #1 out.

For the remote computers buttons to stay updated, the Formula in the button macro has to be set to Immediate, NOT Post.

Any ideas on #2?
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 19 2006 at 16:22 | IP Logged Quote dhoward

Smarty,

#2 will not be directly possible. This is because the PowerHome client cannot tell a remote web browser that a change has occurred because the HTTP protocol is stateless. What this means is that when the browser connects to the PowerHome webserver and requests a page (the control center for instance) the webserver gathers the data, formats it, sends it back to the browser, and closes the connection. No permanent link exists between the too. This is standard HTTP protocol. After the CC has been sent to the browser, a change may occur within PowerHome that changes the CC appearance. The remote browser will have no way of knowing this unless it again requests the Control Center page.

There are two ways to try to overcome this. The first would be to have some client side scripting that refreshes the browser Control Center every so often. This is usually not a very good idea because it can create a lot of network traffic if no changes have taken place.

The second way would be to create some kind of JAVA applet (or activex control) that keeps a persistent connection to the server so that the remote client can be notified. This would be a cleaner solution, but not something that I would be able to work on for awhile.

One thing that is currently planned is a remote Control Center client. This would be a program (instead of a web browser) that would run on a remote machine that would connect to the PowerHome server and maintain a persistent connection and thus keep the CC synchronized between client and server.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
onhiatus
Senior Member
Senior Member
Avatar

Joined: May 12 2004
Location: United States
Online Status: Offline
Posts: 279
Posted: June 19 2006 at 18:13 | IP Logged Quote onhiatus

I solved this somewhat by loading a small "data" psp page that refreshes itself every five seconds. Scripting in my web page then uses the data to update the main page. The first element in the data page is a version, so the script bails out if there's been no change.

This does result in some unnecesary network traffic, but the page is relatively small.

My remote page lags a little, but generally only about 5-10 seconds.

Note this also gets rid of having your web page reload every x seconds - there's no rerendering because the main page only loads the first time.
Back to Top View onhiatus's Profile Search for other posts by onhiatus Visit onhiatus's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: July 14 2006 at 22:04 | IP Logged Quote smarty

Onhiatus,

Any chance you could post the contents of that "data" PSP page you mentioned? I am trying to learn as much as I can about PSP "active content" and how to maximize the usefulness of PH while using a remote display.

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: July 22 2006 at 11:43 | IP Logged Quote TonyNo

I am also interested in this technique!
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 

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