My house automation system is installed in my vacation house for the following purposes:

The elements of the system are:

The Onewire string:

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 Raspberry Pi

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

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 program:

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.

  1. R1 = (status=true && temp<high_limit) || (temp<low_limit)
    1. R1 is the relay running the heating unit
    2. status is 'IN USE' or 'VACANT'
    3. low_limit is the absolute min temprature
    4. high_limit is the minimum temperautre when house is 'IN USE'
    5. temp is the temperature of the DS1820 device with the role og 'temprature master'
  2. R2 = status && (time >= time_on) && (time < time_off)
    1. R2 is the relay running the water punp
    2. status is 'IN USE' or 'VACANT'
    3. time is current time
    4. time_on is the time of day where the pump should be turned on
    5. time_off is the time of day where the pump should be turned off

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 Client - web-application

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.

  1. The main window shows the time, the house status, the status of the relays, the temperature and the fuel oil level.
  2. The device window shows all visible devices with value and acitons.
    1. For temperature devices actuions are:
      1. show graph with high, low, average and moving average of temperature over 3 month
      2. show graph with high, low, average and moving average of temperature over 12 month
    2. for PIO devices aciton is:
      1. togle status of PIO (only possible if the role of the PIO is  not controled by any rules)
  3. The configuration window shows all devices - visible as well as invisible and provide the option of: