summaryrefslogtreecommitdiff
path: root/misc/open2300-mysql/MESSAGE
blob: 820165afe25ee61783178b468762450bfc01e945 (plain)
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
===========================================================================
$NetBSD: MESSAGE,v 1.5 2010/02/05 15:27:27 martin Exp $

Before you can use this program, you need to configure the MySQL
connection in the open2300.conf file. The mysql user used by the
program only needs "insert" priviledges.

You need to creat a table 'weather' in the configured database.
The program code suggests the following table structure:

   CREATE TABLE `weather` (
     `timestamp` bigint(14) NOT NULL default '0',
     `rec_date` date NOT NULL default '0000-00-00',
     `rec_time` time NOT NULL default '00:00:00',
     `temp_in` decimal(2,1) NOT NULL default '0.0',
     `temp_out` decimal(2,1) NOT NULL default '0.0',
     `dewpoint` decimal(2,1) NOT NULL default '0.0',
     `rel_hum_in` tinyint(3) NOT NULL default '0',
     `rel_hum_out` tinyint(3) NOT NULL default '0',
     `windspeed` decimal(3,1) NOT NULL default '0.0',
     `wind_angle` decimal(3,1) NOT NULL default '0.0',
     `wind_direction` char(3) NOT NULL default '',
     `wind_chill` decimal(2,1) NOT NULL default '0.0',
     `rain_1h` decimal(3,1) NOT NULL default '0.0',
     `rain_24h` decimal(3,1) NOT NULL default '0.0',
     `rain_total` decimal(4,1) NOT NULL default '0.0',
     `rel_pressure` decimal(4,1) NOT NULL default '0.0',
     `tendency` varchar(7) NOT NULL default '',
     `forecast` varchar(6) NOT NULL default '',
     UNIQUE KEY `timestamp` (`timestamp`)
   ) TYPE=MyISAM;

Not that the actual field names are not used, but the structure
needs to be compatible. This alternative structure (for newer MySQL
versions) works as well:

   CREATE TABLE `weather` (
     `timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
     `rec_date` date NOT NULL default '0000-00-00',
     `rec_time` time NOT NULL default '00:00:00',
     `temp_in` float NOT NULL default '0',
     `temp_out` float NOT NULL default '0',
     `dewpoint` float NOT NULL default '0',
     `rel_hum_in` int(11) NOT NULL default '0',
     `rel_hum_out` int(11) NOT NULL default '0',
     `windspeed` float NOT NULL default '0',
     `wind_angle` float NOT NULL default '0',
     `wind_direction` enum('N','NNE','NE','ENE','E','ESE','SE','SSE','S',
              'SSW','SW','WSW','W','WNW','NW','NNW') NOT NULL default 'N',
     `wind_chill` float NOT NULL default '0',
     `rain_1h` float NOT NULL default '0',
     `rain_24h` float NOT NULL default '0',
     `rain_total` float NOT NULL default '0',
     `rel_pressure` float NOT NULL default '0',
     `tendency` enum('Steady','Rising','Falling') NOT NULL default 'Steady',
     `forecast` enum('Rainy','Cloudy','Sunny') NOT NULL default 'Rainy',
     PRIMARY KEY  (`timestamp`)
   )
   ENGINE=MyISAM DEFAULT CHARSET=latin1
   COMMENT='Weather as reported by WS 2300';

The program will not output anything, unless errors occur. This
makes it easy to use it in cron jobs.

===========================================================================