Jump to content

webserver module - run program from html


boser

Recommended Posts

Hi Bernhard,

 

The best example would be to open the HTML page of the ISY, select Programs, select a program, and View Page Source.

 

Rand

 

How do I write html code to run on the isy (I have the webserver module) that displays a button (or link) to run a isy program?

 

Many thanks,

Bernhard

Link to comment

Hi Rand,

 

That's what I did but unfortunately the result is a bit cumbersome.

 

The following html fragment will present a button that runs the particular program:

 

form method='POST' action='/pgms'>

input type='hidden' name='id' value='3e'/>

input type='hidden' name='sort' value='4'/>

input type='hidden' name='opt' value='1'/>

input type='submit' name='submit' value='Run Then'/>

/form>

 

It has a few shortcomings / raises questions:

 

1) Clicking the button runs the program, but then redirects to a page displaying button details. Is there a way to control what page I'm redirected to?

 

2) The button displays "Run then". I'd prefer it to display the name of the program. Simply changing value field of submit breaks the code.

 

3) The html code depends on an id field. How is this field computed? I'm concerned that the value of the id field could change (how does the isy assign its value), breaking my code. Where can I find info on these id's?

 

4) Where can I find information on the opt and sort fields? Perhaps that could help me coming up with a solution that more closely matches what I want.

 

Many thanks,

Bernhard

Link to comment

Hi Bernhard,

 

Long time no see!!!

 

Ok, the first thing I recommend is to checkout either of:

TouchSwitch: http://forum.universal-devices.com/viewforum.php?f=49

ISY AJAX: http://forum.universal-devices.com/viewforum.php?f=55

 

In short, what you need to do is to use Javascript, retrieve all the nodes (by going through /rest/nodes), and then let the Javascript interact with ISY and the user with Javascript.

 

With kind regards,

Michel

Link to comment

I'm not sure how to use this environment correctly. How, for example, do I find out when an ID changed? Asking fore program names on each request is too slow.

 

I've now setup a server (independent of the ISY) that keeps a dictionary from program name to ID that is updated every night. Ok for situations where errors are acceptable; an inherently reliable solution would be preferable.

 

Many thanks,

Bernhard

Link to comment

Michael,

 

I use the rest interface presently for two purposes:

 

1) A simple web interface to test the sprinkler system. Basically a button for each zone and a stop button to shut off. The various available web interfaces can already do this, but the interface is unnecessarily complex.

 

In the past I used an X10 RF controller - worked fine but has limited range. The iphone is better (yes, I have mobilink pro, it works well but I have not found out to customize it do do just what I want and simply).

 

2) Notify the ISY of security zone status. My security system makes them available on the web, but unfortunately not in a format the ISY understand. Because of this I wrote a server (running on a plug computer) that listens to the security system's messages and runs suitable programs via the rest interface in the ISY notifying it of changes.

 

Regards,

Bernhard

Link to comment

Hello Bernhard, that makes sense.

 

What you really need is to use either JSDK or WSDK to subscribe to ISY events. This way, when the programs change, you will be notified of the change and then you can reload them to get the correct id for the program.

 

What programming environment do you use in your server?

 

With kind regards,

Michel

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...