Light control via browser

We have written a web application for lighting control system using NooLite.

In application settings you can define the list of pages. On each of them you can add controls (sliders and buttons) that perform some set of actions (turn on/off light, brightness in multiple channels).

Demo (instead of on/off of the light in demo mode shows a text message on the implementation of the action).

We used ASP.NET MVC on the server side, JQuery Mobile on the client (in fact, in the first place it was interesting to control lights with phone). DBMS not required (settings are stored in configuration file). To send commands from PC to control units using a USB adapter PC118.

You can download the app here. There you can download .NET library that implements API for managing system NooLite. The source code for all of this Google Code.

Under the cut is the instructions for installing and configuring from scratch.

Install prerequisites


the

Custom web server (IIS Express)


1. Download the archive with the web application here and unpack, for example, in the folder "C:\noolite".
2. Launching IIS Express (file C:\Program Files\IIS Express\iisexpress.exe) to create the configs by default.
3. Create in the IIS settings entry on the new site. To do this, at the prompt, dial
the
cd C:\Program Files\IIS Express
appcmd add site /name:noolite.web /bindings:"http://%COMPUTERNAME%:19777,http://localhost:19777" /physicalPath:C:\noolite

4. Set ApplicationPool for the site
the
appcmd set app "noolite.web/" /applicationPool:Clr4IntegratedAppPool

5. Launching IIS Express
the
iisexpress /site:noolite.web

Now if you type in the browser "localhost:19777", should open this page:



Custom light control


Application settings relevant to the management of the appliances are in the file NooLite.config in the root folder of the website. By default, this file contains test data:

the
<?xml version="1.0" encoding="utf-8"?>
<nooLiteConfiguration debug="false">
<page id="bedroom" title="Bedroom" description="the Total light and the wall lights in the bedroom">
<control id="main" displayText="General light" type="Switcher" level="155">
<channel id="0" />
</control>
<control id="night-light" displayText="night Light" type="Slider">
<channel id="0" level="0" />
<channel id="1" />
</control>
<control id="all-off" displayText="Disable all" level="0">
<channel id="0" />
<channel id="1" />
</control>
</page>
<page id="hallway" title="Corridor">
<control id="main" displayText="off" type="Switcher">
<channel id="2" />
</control>
<control id="small" displayText="Near the kitchen" type="Switcher">
<channel id="3" />
</control>
<control id="all-off" displayText="the corridor" type="Switcher">
<channel id="2" />
<channel id="3" />
</control>
</page>
</nooLiteConfiguration>


USB adapter PC118 has 8 channels, each of which can be linked with a group of lamps (or other appliances).

Inside the root element nooLiteConfiguration contains a collection of page. Each of them describes a separate page of the application. The element page has id (the page ID is used in the formation of its addresses), title (title) and description (the description displayed on the page above).

Inside each page is multiple control. They identify a set of controls on the page. The control element has an id (control ID), displayText (a text label), type (type of control), and level (the brightness level is set for lamps when using this control, for example, when you press the button).
The parameter type can be one of the following values:
the
    the
  • button which sets the lamp brightness level specified in the parameter level;
  • the
  • Switcher — a group of two buttons: "ON" and "OFF". The "ON" button works similarly to the element "Button", "OFF" button turns off the light in all linked channels.
  • the
  • Slider — the slider and the button "SET", which sets for the specified group of channels, the brightness level selected using the slider.


Inside each control you can specify a set of channels (channel) to which you want to send commands when using this control. The channel has the parameters id (channel number — a number from 0 to 7) and level (the brightness level for the channel has priority over the value of level control).

The following is an example of the display of controls for the page "bedroom" from a set of test data.



concluding remarks


I had long wanted to automate control of electrical appliances. To control the light via the remote, namely, to be able to write programs that control the light on the desired algorithms without human intervention. For a long time was not available hardware with desired capabilities. I even gathered your own device (Arduino+XBee) but the resulting bundle of circuits and wires it was difficult to adapt for use in real life.

When I first learned about "the Belarusian company, which is developing radio-controlled switches", I am reminded of the story about monitors "INTEGRAL", laughed and forgot about it. But after review system NooLite habré I ordered a couple of these switches and it was very cool. I think these things and the people who create them, and make our world better. They show us that the future that we could only dream of in the childhood, already very close — much closer than we think.

I would really like to have the system NooLite and other similar projects developed and into our lives. That is why I spent the weekend on light control via a browser. And I am willing to spend my time on implementing similar tasks.

Thank you for your attention!
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Why I left Google Zurich

2000 3000 icons ready — become a sponsor! (the table of orders)

New web-interface for statistics and listen to the calls for IP PBX Asterisk