Jump to content

What are the limitations on the REST interface?


MarkJames

Recommended Posts

I've got a custom page designed to display the status of all the El;k zones, keypads, and areas in my house.  There's about 45 total items to display.

 

I'm using the REST interface to call /rest/elk/get/status and then parsing the xml to update all my html elements.  I haven't found a way to specifically query an individual zone/area/keypad - all I've found is all or nothing.  The REST call returns the status of, from what I can tell, everything known to the Elk - including the default 208 outputs.  

 

Anyways - it happens right quick and to give the appearance of 'real time' monitoring I've been updating the status of my html every few seconds - basically changing the color/text of a series of buttons according to their corresponding zone state - Violated, Normal, Bypass

 

My question is at what point will the ISY start seeing degraded performance because of the frequent REST calls?  Is there a recommended minimum interval between calls?  Will frequent REST calls slow program flow/trigger?

 

Thanks,

 

mark

 

Link to comment

Hi Mark,

 

Since ISY is event driven, then as long as the rest commands do NOT require underlying queries (such as get topology, set zone, etc.) then you can do it as frequently as you wish (even 1 second) since the only thing being returned is the value at that moment.

 

This said, a better approach would be to subscriptions. If you use JavaScript, you can use websockets to subscribe to ISY and thus you won't have to poll it at all. All changes are automatically published to you.

 

With kind regards,

Michel

Link to comment

Thanks Michel,

 

I've been learning javascript for the sole purpose of creating this page.  I wasn't aware that subscribing/websockets was even an option.  I'll see if I can find some more info about or some sample code in the wiki.

 

mark

Link to comment

Thanks Michel,

 

I've been learning javascript for the sole purpose of creating this page. I wasn't aware that subscribing/websockets was even an option. I'll see if I can find some more info about or some sample code in the wiki.

 

mark

I provided an example that's certainly on here somewhere, and may even be on the Wiki already....

 

Edit: see here: http://forum.universal-devices.com/index.php?/topic/15248-Problems-Creating-a-WebSocket-connection

 

Michael.

Link to comment

Thanks Michael!

 

I'd found the repository on github with a full implementation but it was for a test server and had little documentation with it - I think it was for more advanced programmers than myself.

 

This is more my speed.

 

Out of curiosity - before I rewrite chunks of code - is websockets compatible across most browsers?  I've got a raspberry pi 3 hosting my site and it's not bothered by the constant polling.  If the ISY isn't hurt by it either then I'm inclined to leave it the way it is if websockets might cause me some browser compatibility issues.

 

 

mark

Link to comment

We got it working across chrome, Firefox and IE, with Chrome on Android and Safari on IOS. I have not looked at others.

 

It does require a recent build of ISY though - there were fixes made to make it work (detailed in the thread I referenced).

 

A Websocket connection is far more network and battery efficient that polling...

 

Michael.

Link to comment

Yes it does in the admin console. That is the only place though.  So I'm looking into something like this perhaps in conjuction with HAD to be able to have a webpage to see the status of things around the house.

 

Only downside is that I'm not a programmer so it will take a lot of learning.   I'll start looking into it.

Thanks for the reply. 

Link to comment

Yes it does in the admin console. That is the only place though.  So I'm looking into something like this perhaps in conjuction with HAD to be able to have a webpage to see the status of things around the house.

 

Only downside is that I'm not a programmer so it will take a lot of learning.   I'll start looking into it.

Thanks for the reply. 

 

That's exactly what I'm doing at the moment.  

 

I think that in the next week or so it should be where I'm content with it.  If you're still looking for a solution I can link you to what I've done and if you want to use it you're welcome to the source.  I'm not a programmer either but used to be - it's not too hard.  The code I've written is simple enough to change - just change the addresses of the nodes, the names of the devices, and the id's of the web elements and it takes care of itself.

 

mark

Link to comment

That's exactly what I'm doing at the moment.  

 

I think that in the next week or so it should be where I'm content with it.  If you're still looking for a solution I can link you to what I've done and if you want to use it you're welcome to the source.  I'm not a programmer either but used to be - it's not too hard.  The code I've written is simple enough to change - just change the addresses of the nodes, the names of the devices, and the id's of the web elements and it takes care of itself.

 

mark

Good deal. I would love to see what you're doing when you get time.

Thanks for offering.

Link to comment

Archived

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


  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

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