Programming

Server-Side Scripting

The WebCell can serve up static web pages, simply sending the file (typically containing HTML) as-is. But it can also generate content on the fly with Embedded CellScript, a scripting language very much like JavaScript. Files with Embedded CellScript have the extension “.ecs” and are processed by the WebCell each time they are requested.

CellScript code in the file is contained within the special markers “<%” and “%>”. Anything not contained within these markers is simply passed through unchanged. The file could contain HTML with any number of CellScript blocks, or it could contain nothing but a single block of CellScript.

CellScript is a subset of JavaScript. Types include Boolean, number (floating-point and integer), string, array, and predefined objects. Variables can be assigned any type, and there are automatic conversions between types (perform arithmetic on the string “3” and it will be converted to the number 3). CellScript has a full set of arithmetic, logical, and conditional operators and the common control statements such as if/else, for, and while. It has functions to manipulate strings, perform higher math (sqrt, log, sin, etc.), manage date and time, and format and parse numbers.

CellScript includes a number of predefined objects that allow access to hardware features. These include the Cell object for I/O, the Net object for the network interface, and the File object for file access. For example, to set the values of one bank of I/O pins you use a statement like:

Cell.PortA.pins = 0x81;

A common use for the WebCell is to present a web form to collect some kind of data from the user (thermostat settings, for example). This data is very easy to access in CellScript: for each name/value pair sent by the web browser, the system automatically declares a CellScript variable of that name initialized to the value. If multiple values have the same name, they are formed into an array.

CellScript plays well with advanced web page techniques such as AJAX. In fact, none of our home automation web pages have a “submit” button. Instead, client-side JavaScript sends updated data to the WebCell as soon as it is entered by the user.

INSTEON Home Automation

If you want to use the WebCell with INSTEON home automation devices, no programming of any kind is required. We provide a set of web pages that gives you control over INSTEON thermostat, irrigation, power, and lighting devices. No programming skills needed -- it's ready to go.