Programming Extron HTML for reading projector statuses

Note: I intended to publish this a while back. It's now mostly obsolete, but can explain a little more about the SSI stuff mentioned here.

In what amounts to a sort of follow-up to my projector control pages, I have recently been working on some code to do the following:

  1. Show statuses in a pretty, end-user-friendly format.

That's it!

Okay... while the above *is* true, the actual process is a bit more involved:
  1. Grab the status from the Extron box via Server-Side Includes
  2. Have a script on a server somewhere that runs every few seconds, and dumps the statuses from all the Extron boxes in the building, into one big file.
  3. Have another script go through and analyze this file, pull out the relevant information, and spit out JavaScript code based on what it finds
  4. Have webpages that, via polling, update every few seconds to grab the latest version of this JavaScript and display it to the end user

I'm sure much of this could be done more efficiently, but I'm at the stage where I just want to get it "working", and then I can focus on optimizations, better code, and maybe put everything into one massive script that talks directly with the client web browser via AJAX calls and such.

Time for a little more detail...
On pages 4-19 to 4-24 of this manual, there's talk about these Server Side Includes, or SSI, code that can do magical things. The biggest downside is that once you upload an HTML file with SSI code, you can't re-download it (or right-click, view source) to reverse-engineer how it works - because it (the Extron box) actually changes the HTML code of the webpage. This is a feature, not a bug - it's part of how the SSI functionality works.

All of my code is on Github, as usual - and it's very much still a work-in progress. Reading through the relevant parts of the manual (as referenced above), it seems that one's missing something - a feeling of "that's it?", but no... that's it! It's quite magical to upload a webpage that is only a few lines long, but outputs very useful status information. I discovered that, if you don't care about formatting, you can just name the file something ending in ".html", and Extron will happily treat it as valid SSI, provided you use their syntax properly.

No comments: