Saturday, September 03, 2011

Setting HomeAutomation up to use 1-wire

As I said in an earlier post HomeAutomation is a really nice web server app based on PHP with a MySQL backend supporting Telldus Tellstick devices for controlling remote sockets.

It also usefully supports monitoring temperatures from 1-wire devices using various protocols. The one I am using is owfs (one wire
file system). You can see the temperatures displayed on the house floorplan in the screenshot below.


Additionally, if you click on one of the temperature labels, you get a really nice popup graph of the recent data for that sensor.

And there is a full page with data such as high and low for each sensor, and 24 hour, 7 day, and 30 day graphs for each sensor.


To get all this working is fairly easy and should not take too long

Firstly download weather parser.zip from http://karpero.mine.nu/ha/downloads and unzip to /var/www/HomeAutomation

install php gd graphing library
apt-get install php5-gd
You then need to install some additional fonts
ensure the following line is in /etc/apt/sources.list
deb http://ftp.us.debian.org/debian/ testing main contrib non-free
then
apt-get update
apt-get install msttcorefonts
next, edit /var/www/HomeAutomation/parser/parser-config.php and uncomment the 1-wire system used.

add the following command to the crontab which will query the sensors every 15 minutes.
*/15 * * * * php /var/www/HomeAutomation/parser/parser.php
edit the appropriate php file in /var/www/HomeAutomation/parser/system_config as I am using owfs, I need to edit owfs.php, and add lines for each sensor.
$sensorsToParse["Kitchen"] = "/lwire/10.E1CA5B020800/temperature";
The directory name will vary from sensor to sensor as it is the sensor's address.

Once all the sensors are in, at a command line type the following to read the data from the sensors.
php /var/www/HomeAutomation/parser/parser.php
Open the HomeAutomation site in a browser

In Configuration, settings enable the "use 1-wire temperature" and save.
Refresh the page, and you should see some additional options.

In Configuration, open "Temperature sensor" and click "update sensors" this will pull in the list of sensors from the database which was populated by running the parser.php command earlier.

In Configuration, select House Plan. This will allow you to select each device and sensor from a menu and place them on the house plan.

And that should be job done...

1 comment:

dnalleh said...

Great guide. But how do I find the path for the sensors to put in owfs.php?