mdsh.com/wiki


RecentChanges

TextFormattingRules
AllWikiTopics
OrphanedWikiTopics
ToDoWikiTopics
WikiLockList
RSS
Export2HTML

WikiSearch

SetUsername

StartingPoints
Home
Heatmiser

Install and basic configuration of the Heatmiser software

Adapted for server style installation from: http://code.google.com/p/heatmiser-wifi/wiki/InstallationBasic
Get the software required to get the Heatmiser software:
$ sudo apt-get update
$ sudo apt-get install subversion


Get the Heatmiser software:
$ cd /usr/share
$ sudo svn export http://heatmiser-wifi.googlecode.com/svn/trunk/ heatmiser-wifi


Install required modules for the Heatmiser software to run:
$ sudo apt-get install -y libxml-simple-perl libjson-perl
$ sudo cpan CGI Cwd DBI File::HomeDir Getopt::Std IO::Socket JSON LWP::UserAgent Proc::Daemon Proc::PID::File Time::HiRes XML::Simple

Answer yes to any questions about whether the tool should configure itself and choose mirror sites automatically

Test with command line parameters:
cd heatmiser-wifi
$ bin/heatmiser.pl -h <HOST> -p <PORT>


Configure, and test again:
$ vi /etc/heatmiser.conf
# These settings are used by the Perl software for connecting to the Heatmiser thermostat
HOST <HOST>
PIN <PORT>

For all configuration options see: http://code.google.com/p/heatmiser-wifi/wiki/ConfigurationOptions
$ bin/heatmiser.pl

Run as Daemon

Get the software requireed to run as a daemon:
$ sudo apt-get update
$ sudo apt-get install mysql-server


Create MySQL account
$ mysql -u<ROOT_USER> -p<PASSWORD>
mysql> CREATE DATABASE heatmiser;
Query OK, 1 row affected (0.02 sec)

mysql> CREATE USER 'heatmiser'@'localhost';
Query OK, 0 rows affected (0.15 sec)

mysql> GRANT ALL ON heatmiser.* TO 'heatmiser'@'localhost';
Query OK, 0 rows affected (0.04 sec)

mysql> QUIT;
Bye


Test connection to MySQL:
$ mysql -u heatmiser heatmiser
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| heatmiser |
+--------------------+
2 rows in set (0.00 sec)

mysql> SHOW GRANTS FOR 'heatmiser'@'localhost';
+------------------------------------------------------------------+
| Grants for heatmiser@localhost |
+------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'heatmiser'@'localhost' |
| GRANT ALL PRIVILEGES ON `heatmiser`.* TO 'heatmiser'@'localhost' |
+------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> QUIT;
Bye


Optionally add configuration options:
$ vi /etc/heatmiser.conf
# These settings are used by the Perl software for connecting to the MySQL database
# DBSOURCE dbi:mysql:heatmiser
# DBUSER heatmiser
# DBPASSWORD heatmiser

For all configuration options see: http://code.google.com/p/heatmiser-wifi/wiki/ConfigurationOptions

Install daemon script and init.d script:
$ sudo ln -s /usr/share/heatmiser-wifi/bin/heatmiser_daemon.pl /usr/local/bin/heatmiser_daemon
$ sudo ln -s /usr/share/heatmiser-wifi/bin/init /etc/init.d/heatmiser_daemon


Start service and test:
$ sudo service heatmiser_daemon start
$ cat /var/log/heatmiser

May 27 11:29:46: >>>> heatmiser_daemon started >>>>
$ mysql -u heatmiser heatmiser
mysql> SHOW TABLES;
+---------------------+
| Tables_in_heatmiser |
+---------------------+
| comfort |
| events |
| settings |
| temperatures |
| timer |
| weather |
+---------------------+
6 rows in set (0.00 sec)

mysql> SELECT * FROM settings;
+------------+----------+------------+
| thermostat | name | value |
+------------+----------+------------+
| heatmiser | holiday | |
| heatmiser | mode | heating |
| heatmiser | version | 1.6 |
| heatmiser | model | PRTHW |
| heatmiser | progmode | 5/2 |
| heatmiser | units | C |
| heatmiser | vendor | Heatmiser |
| heatmiser | host | heatmiser |
+------------+----------+------------+
8 rows in set (0.00 sec)

mysql> QUIT;
Bye


Set daemon to start at boot time:
$ sudo update-rc.d heatmiser_daemon defaults
Adding system startup for /etc/init.d/heatmiser_daemon ...
/etc/rc0.d/K20heatmiser_daemon -> ../init.d/heatmiser_daemon
/etc/rc1.d/K20heatmiser_daemon -> ../init.d/heatmiser_daemon
/etc/rc6.d/K20heatmiser_daemon -> ../init.d/heatmiser_daemon
/etc/rc2.d/S20heatmiser_daemon -> ../init.d/heatmiser_daemon
/etc/rc3.d/S20heatmiser_daemon -> ../init.d/heatmiser_daemon
/etc/rc4.d/S20heatmiser_daemon -> ../init.d/heatmiser_daemon
/etc/rc5.d/S20heatmiser_daemon -> ../init.d/heatmiser_daemon


Set the logs to rotate:
$ sudo vi /etc/logrotate.d/heatmiser
/var/log/heatmiser {
		  monthly
		  rotate 12
		  compress
		  delaycompress
		  missingok
		  notifempty
		  create 644 root root
}


Configure webserver

Adapted for my style of hosting from http://code.google.com/p/heatmiser-wifi/wiki/InstallationWebInterface
Get the software requireed to run as a daemon:
$ sudo apt-get update
$ sudo apt-get install apache2


Edit any DNS configuration required and reload DNS server.

Create web hosting virtual sites.
$ cd <LOCATION>/sites/<SITE>
$ mkdir -p <HOST>/ROOT
$ mkdir -p <HOST>/heatmiser
$ mkdir -p <HOST>/cgi-bin/heatmiser


$ ln -s /usr/share/heatmiser-wifi/html/index.html <HOST>/heatmiser/index.html
$ curl -o <HOST>/heatmiser/jquery-1.7.2.min.js http://code.jquery.com/jquery-1.7.2.min.js
$ curl -o /tmp/Highstock-1.1.5.zip http://www.highcharts.com/downloads/zips/Highstock-1.1.5.zip
$ unzip -j /tmp/Highstock-1.1.5.zip js/highstock.js -d <HOST>/heatmiser/
$ rm /tmp/Highstock-1.1.5.zip
$ ln -s /usr/share/heatmiser-wifi/bin/heatmiser_cgi.pl <HOST>/cgi-bin/heatmiser/ajax.pl


Which should leave you with this layout:
$ tree <HOST>
<HOST>
|-- ROOT
|-- cgi-bin
|...`-- heatmiser
|.......`-- ajax.pl -> /usr/share/heatmiser-wifi/bin/heatmiser_cgi.pl
`-- heatmiser
....|-- highstock.js
....|-- index.html -> /usr/share/heatmiser-wifi/html/index.html
....`-- jquery-1.7.2.min.js


Edit Apache config file (where ever you maight have it):
<virtualhost *:80>
servername <SERVER>
CustomLog <LOCATION>/sites/<SITE>/logs/access_log-leyborne combined
documentroot <LOCATION>/sites/<SITE>/<HOST>/ROOT
directoryindex index.html

<Directory "<LOCATION>/sites/<SITE>/<HOST>/ROOT">
Options FollowSymLinks MultiViews Includes
AllowOverride options indexes
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin <LOCATION>/sites/<SITE>/<HOST>/cgi-bin
<Directory "<LOCATION>/sites/<SITE>/<HOST>/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +FollowSymLinks
Order allow,deny
Allow from all
</Directory>
Alias /heatmiser <LOCATION>/sites/<SITE>/<HOST>/heatmiser
<Directory "<LOCATION>/sites/<SITE>/<HOST>/heatmiser">
Options FollowSymLinks MultiViews Includes
AllowOverride options indexes
Order allow,deny
Allow from all
</Directory>
</virtualhost>


Test in a web browser.

External temporature

Adapted from http://code.google.com/p/heatmiser-wifi/wiki/InstallationWeather

Follow the above instructions to select a weather source

Test with:
bin/heatmiser_weather.pl -w <SERVICE> -k <KEY> -g 3672 <LOCATION>

Add configuration options:
$ vi /etc/heatmiser.conf
# These settings are used by the Perl software for connecting to the Weather source
WSERVICE <SERVICE>
WKEY <KEY>
WLOCATION <LOCATION>
# WLOGRATE is the ratio of thermostat logs to weather-service requests (10 mins for a default 1 min internal period)
WLOGRATE 10

For all configuration options see: http://code.google.com/p/heatmiser-wifi/wiki/ConfigurationOptions

Restart the daemon:
$ sudo service heatmiser_daemon restart

Test that data is arriving in the MySQL database:
$ mysql -u heatmiser heatmiser
mysql> SELECT * FROM weather;
+---------------------+----------+
| time | external |
+---------------------+----------+
| 2013-05-26 17:00:00 | 17.9 |
+---------------------+----------+
1 row in set (0.00 sec)

mysql> EXIT
Bye


Set the time

Adapted for server style installation from: http://code.google.com/p/heatmiser-wifi/wiki/InstallationTimeSync

Set the time manually:
$ TZ="Europe/London" bin/heatmiser_time.pl -v

Set the time every hour (in case it drifts and for DST changes):
$ sudo vim /etc/cron.d/heatmiser_time
1 * * * * root TZ="Europe/London" /usr/share/heatmiser-wifi/bin/heatmiser_time.pl


Heatmiser is mentioned on: StartingPoints


VeryQuickWiki Version 2.8.1 | Admin

All contents copyright mdsh.com (C) 2011-2023.