My house automation system is installed in my vacation house for the following purposes:
The elements of the system are:
The onewire string runs thrue the house and connects DS1820 temperature sensors, DS2408 PIO devices driving relays to control the heating unit and pumps and DS2438 to collect voltage level from a ultra sound device sensing the fuel oil level in the tank.
In teori the onewire string is only two wires, but I also distribute power to the relays and the tank monitor.
The onewire string is connected to the Raspberry Pi via a I2C interface. This could also be implementet with a onewire USB host adapter.
The following software is installed in the Pi:
The following node_modules are installed using npm install:
I have made an installation package holding alle files and scripts required to install Node.js
I use owserver to provide a tcp/ip socket on port 4304
I use owhttpd to provide a web monitor on port 2121
I use owfs to mout a directory structure of all onewire devices on the onewire string.
I have compiled a version of OWFS (the one to pick from 'apt-get install owfs' does not have the owfs module!)
I have made an installation package holding alle files and scripts required to install OWFS and run it as a service on system start.
The engine has been implemented as a node_module. It provides an object with the folowing
The engine loops thru the directory structure created by owfs and looks for changes. Changes will generate an event to the server program.
Information about the roles, locations and the names of my onewire devices are kept in files. These fiels can be opdated via the functions. When changed they will created a watch event that will cause an update of the device array and an event to the server program.
In my first attempt I tried to use the owfs module available with node.js, but I was not able to prevent it from crashing after some time.
The server application communicates with the clients using socket-io.
The server application holds the rulles (like at which temperature should a certain relay be switched on or off and in which timeperiode are the temperature limit valid).
Whenever any of the parameters are changed - from the engine or from a client - the rules will be checked and required action taken.
The parameters that can change the rules are:
The main rules are prety simple.
Socket-io keeps track of which clients are connected.
When the parameters changed or the rules change the status of the relays, the changes in the device-array wíll be distributed to all connected clients.
when a client change a parameter, rules are checked at changes distributed to all connected clients.
Changing parameters from the client require authorization.
The purpose of the web-application is to communicate with the server-program in order to provide a user interface to the user.
This could be any program or APPs (an APP for IOS and Android has been created) but the application I use most is fetched from a web server as a html document (.html) containing javacode and html objects. In additon to the html document required images (.jpg), style sheets (.css) and java modules (.js) are used.
The web application uses jquery and jquery mobile to handle the layout.
The benefint of this approach is to make sure changes to the client program is distributed in time.
The web-application can be fetched from any web-server or it can be stored on the client as an offline browsable program (if offline, communication with the server program will not be available)
The web application has a main template and 3 selectable windows.
The mail template shows the name of the application (OwHouse) and an indicator for online status (yellow if online). On the bottom bar there are buttons for each of the 3 windows available.