Http request with homeseer

Introduce home automation related software here.....
Post Reply
User avatar
DMB
Member
Member
Posts: 136
Joined: Tue Jun 27, 2006 7:11 pm
Location: Netherlands

Http request with homeseer

Post by DMB »

After playing a while with AJAX (Asynchronous Javascript And Xml) http request I thought it would maybe be interesting to post a sample of this technique in combination with the homeseer webserver.

With the http request it is possible to refresh a part of a html page without refreshing the whole page. Something what we would like on the homeseerstatus page.

I will try to explain the technique, but I am not an expert.
The base of the code was taken from www.w3schools.com .

We need the homeseertest.html script who calls every 2 seconds a javascript function showinfo (gethomeseerinfo.js).

In showinfo a connection is made to the XMLHttpObject of the webbrowser.
A sort of connection is made with the homeseerwebserver and the script homeseerinfo.asp will be run on the webserver. During the execution of this script, the browser is waiting for data from the webserver.
The homeseerinfo.asp collects device information from homeseer and send this info back to the webbrowser.
The received data is put on the screen using the id homeseerinfo (homeseertest.html).

Download the attachment Image homeseerxmlhttp.zip and put all the files in the homeseer html directory.
You can run the test in a webbrowser with the url http://localhost/homeseertest.html

Every 2 seconds the status of the device (defined in homeseerinfo.asp) will be refreshed.

The screen should look like:

Image

Greetings,

DMB
Post Reply

Return to “Announcements & News”