Zenah
From Automated Home
The home automation comes to live with Zenah, from here we can define rule sets that act upon those xpl messages found by the xpl-perl package. Ofcourse we first need to have a working environment.
Contents |
[edit] SVN with Zenah
You do need the following packages:
apt-get install libxpl-perl librrds-perl libdatetime-event-sunrise-perl libdatetime-event-recurrence-perl libtimedate-perl rrdtool hddtemp libmodule-install-perl libcatalyst-perl libtemplate-perl libdbd-sqlite3-perl libclass-dbi-sqlite-perl libclass-dbi-loader-relationship-perl libclass-dbi-asform-perl libclass-dbi-fromform-perl libcatalyst-plugin-formvalidator-perl libdatetime-format-strptime-perl libclass-dbi-sweet-perl libtemplate-perl libcatalyst-modules-perl
- NOTE: if you installed the svn version of xpl-perl, you should remove the libxpl-perl in the list above (since you allready got it)
svn co http://www.zenah.org.uk/svn/zenah/trunk zenah
After this you should try:
perl Makefile.PL make
Set your LONGITUDE & LATITUDE (try http://www.fallingrain.com/ , it will show your values)
export LONGITUDE=4.4000 export LATITUDE=51.9167 export TZ=Europe/Amsterdam
Fill the default SQLite3 database with sample-data (Zenah will not start with an empty database!)
sqlite3 zenah.db < zenah.sample.sql3
Then run the following to start her up.
perl -Iblib/lib blib/script/zenah
NOTE: This automatically also starts-up the frontend webserver. In case it does not come up, you can start it with:
perl -Iblib/lib blib/script/zenah_server.pl
[edit] Using Mysql with Zenah
Ofcourse you need a user db and a user for it:
mysql -u root -p mysql <<EOF
CREATE DATABASE zenah;
GRANT ALL on zenah.* TO zenah@localhost;
SET PASSWORD FOR zenah = PASSWORD("passw0rd");
EOF
Then you need to make the sqlite test db working with mysql, which can be done with some perl lines.
(this is no longer needed.. this is fixed in the newer releases) perl -ne 's/INTO "([^"]+)"/INTO $1/; print unless (/^(BEGIN TRANS|COMMIT)/ or /^CREATE/ .. /^\);/)' zenah.sample.sql3 |mysql -u root -p zenah
Make sure you change your zenah.dbi.conf to point to the mysql database (see the example layout in the file itself)
[edit] Tips
Want to change the working config file, you can do this by changing the ZENAH_DBI_CONFIG. like:
ZENAH_DBI_CONFIG=other.sql.file.conf
[edit] Troubleshooting
If you have the following errors when trying to start the rules engine:
closing dbh with active statement handles at /usr/share/perl5/Class/DBI/Loader/SQLite.pm line 110. Use of uninitialized value in hash element at /usr/share/perl5/Class/DBI/Loader/Generic.pm line 79. Use of uninitialized value in hash element at /usr/share/perl5/Class/DBI/Loader/Generic.pm line 79.
This could be because you set your ZENAH_DBI_CONFIG=xxxxx to the incorrect file, if this is not correct it will produce these errors!
