-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
151 lines (87 loc) · 4.04 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
WiControl
=========
Wireless Control with Panstamp and Raspberry Pi.
Installation:
-------------
On the Pi:
This assumes you have an out-of-the-box Raspberry Pi SD card with no extra software installed.
First set your local timezone:
$ sudo dpkg-reconfigure tzdata
You may want to change the default name of the Pi ("raspberrypi") to something more appropriate
like "heatingcontrol". To do that:
$ sudo nano /etc/hostname
That file contains a single name - the name of the Pi. Change it to what you want, save the file, then reboot.
Change you password:
$ passwd
And enable ssh:
$ sudo raspi-config
Next install Apache and PHP:
$ sudo apt-get update
$ sudo apt-get install apache2 -y
$ sudo apt-get install php5 libapache2-mod-php5 -y
At this point it is a good idea to check that the webserver is now running. In the URL address bar of a web browser on a PC or phone type
myname.home/
where myname is the Pi's name that you created above (some networks need myname.local instead). If you don't get anything type
$ ifconfig
on the Pi. This will tell you the Pi's IP address (something like 192.168.1.163). Type that IP address into the web browser's URL bar. You should see the default Apache/Debian server homepage.
Next install ftp:
$ sudo apt-get install ftp
And the ftp demon:
$ sudo apt-get install pure-ftpd
Create an ftp user (see https://www.raspberrypi.org/documentation/remote-access/ftp.md) called "upload" with access to the html directory:
$ sudo groupadd ftpgroup
$ sudo useradd ftpuser -g ftpgroup -s /sbin/nologin -d /dev/null
$ pushd /var/www/html/
$ sudo chown -R ftpuser:ftpgroup .
$ sudo pure-pw useradd upload -u ftpuser -g ftpgroup -d /var/www/html -m
[** You will be asked to create a password for the user upload at this point**]
$ sudo pure-pw mkdb
$ sudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/60puredb
$ sudo service pure-ftpd restart
$ popd
You next need to install the heating software:
$ git clone https://github.com/AdrianBowyer/WiControl.git
$ cd WiControl
Copy the control file:
$ cp run-heat-control.sample run-heat-control
and edit the file run-heat-control and replace the "zone-1"s with the name of the zone you want.
Copy the sending file:
$ cp sendtemps.sample sendtemps
and edit the sendtemps file to include the ftp password you set above and to change zone-1 to the name of your zone.
Backup the webserver's index file, and copy all the heating web files there and set permissions:
$ sudo mv /var/www/html/index.html /var/www/html/index.html.old
$ cd Web
$ sudo cp -r * /var/www/html
$ sudo chown -R ftpuser:ftpgroup /var/www/html
$ sudo chmod 666 /var/www/html/*.dat
$ sudo chmod 777 /var/www/html/zone-1-Profiles
Finally
$ sudo crontab -e
and add lines at the end like this:
* * * * * /home/pi/WiControl/run-heat-control
0 4 * * * /sbin/shutdown -r +5
That will cause the shell script run-heat-control to be run once a minute, and cause a
system reboot at 04:05 in the morning to keep everything clean and tidy. The sudo is
needed because shutdown needs root privilege.
On the PanStamps:
You can just about run the Arduino IDE on the Raspberry Pi, but it's probably better to
use a big serious computer to do this bit. Install the Arduino IDE on your computer if
you haven't already got it:
https://www.arduino.cc/en/Main/Software
And clone the repository https://github.com/AdrianBowyer/WiControl.git as you did on the Pi.
Load the arduino program in the folder Panstamp-control into the IDE.
At the head of the file Control.h set up your heating zones and device names and numbers. Load
this program into each device (e.g. boiler, radiator) on your heating system.
Running
-------
When it runs it creates a status file called Status.
$ cat Status
will tell you what your system last did. If you
$ touch Log
then each time run-heat-control runs it will append the status
report to the end of itself, which keeps a history and is therefore
useful for debugging.
When you have finished debugging don't forget to
$ rm Log
otherwise it will eventually fill up the SD/disc...
Adrian Bowyer