Jump to content

webserver module - run program from html


boser

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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

Posted

Hi Bernhard,

 

The main question is: what's your ultimate goal?

 

As far as being notified of changes to IDs, our WSDK/JSDK both provide events which let you know that something changed. You will have to subscribe to ISY to get those events.

 

With kind regards,

Michel

Posted

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

Posted

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

Posted

Michel,

 

Not sure what your question is. I do my programming in netbeans. The programs run on a plug computer.

 

Where can I find out more about / get the ISY Java API?

 

Bernhard

Guest
This topic is now closed to further replies.

×
×
  • Create New...