From 2ca7dd70a97646d6384c9c2d02de0ee6e285925a Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 10 Nov 2004 08:21:21 +0000 Subject: Import of open2300-mysql - an add-on to the open2300 pkg, that logs data from the weather station to a mysql database. --- misc/open2300-mysql/DESCR | 2 ++ misc/open2300-mysql/MESSAGE | 59 ++++++++++++++++++++++++++++++++++++++++++++ misc/open2300-mysql/Makefile | 16 ++++++++++++ misc/open2300-mysql/PLIST | 2 ++ 4 files changed, 79 insertions(+) create mode 100644 misc/open2300-mysql/DESCR create mode 100644 misc/open2300-mysql/MESSAGE create mode 100644 misc/open2300-mysql/Makefile create mode 100644 misc/open2300-mysql/PLIST (limited to 'misc') diff --git a/misc/open2300-mysql/DESCR b/misc/open2300-mysql/DESCR new file mode 100644 index 00000000000..a19734d4065 --- /dev/null +++ b/misc/open2300-mysql/DESCR @@ -0,0 +1,2 @@ +Open2300-mysql reads data from a Weather Station 23xx and inserts +it into a mysql database. diff --git a/misc/open2300-mysql/MESSAGE b/misc/open2300-mysql/MESSAGE new file mode 100644 index 00000000000..0c798d79e36 --- /dev/null +++ b/misc/open2300-mysql/MESSAGE @@ -0,0 +1,59 @@ +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` ( + `id` datetime NOT NULL default '0000-00-00 00:00:00', + `day` date NOT NULL default '0000-00-00', + `clock` time NOT NULL default '00:00:00', + `tempin` float NOT NULL default '0', + `tempout` float NOT NULL default '0', + `dewpoint` float NOT NULL default '0', + `humin` int(11) NOT NULL default '0', + `humout` int(11) NOT NULL default '0', + `windspeed` float NOT NULL default '0', + `winddir` float NOT NULL default '0', + `windcode` enum('N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW') character set ascii NOT NULL default 'N', + `windchill` float NOT NULL default '0', + `rain1` float NOT NULL default '0', + `rain24` float NOT NULL default '0', + `raintotal` float NOT NULL default '0', + `pressure` float NOT NULL default '0', + `tendency` enum('Steady','Rising','Falling') character set ascii NOT NULL default 'Steady', + `forecast` enum('Rainy','Cloudy','Sunny') character set ascii NOT NULL default 'Rainy', + PRIMARY KEY (`id`) + ) + 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. diff --git a/misc/open2300-mysql/Makefile b/misc/open2300-mysql/Makefile new file mode 100644 index 00000000000..8cc89da727a --- /dev/null +++ b/misc/open2300-mysql/Makefile @@ -0,0 +1,16 @@ +# $NetBSD: Makefile,v 1.1.1.1 2004/11/10 08:21:21 martin Exp $ +# + +PKGNAME= ${DISTNAME:S/-/-mysql-/} +COMMENT= WS 23xx weather station MySQL support + +PATCHDIR= ${.CURDIR}/../open2300/patches +DISTINFO_FILE= ${.CURDIR}/../open2300/distinfo + +ALL_TARGET= mysql2300 +INSTALL_TARGET= install-mysql + +USE_BUILDLINK3=yes + +.include "../../mk/mysql.buildlink3.mk" +.include "../open2300/Makefile.common" diff --git a/misc/open2300-mysql/PLIST b/misc/open2300-mysql/PLIST new file mode 100644 index 00000000000..7e9a65c8028 --- /dev/null +++ b/misc/open2300-mysql/PLIST @@ -0,0 +1,2 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2004/11/10 08:21:21 martin Exp $ +bin/mysql2300 -- cgit v1.2.3