From 124e9e547dd418b294673602f7ef1720688e1daa Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Tue, 28 Dec 2010 00:12:43 +0100 Subject: [PATCH 01/12] ...more path updates --- misc/tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/tools/install.sh b/misc/tools/install.sh index 2e5eb1c..9d73bfb 100755 --- a/misc/tools/install.sh +++ b/misc/tools/install.sh @@ -124,7 +124,7 @@ ask "insert demo data in to database?" n if [ "$REPLY" == "y" ]; then get_admin get_db_name - cat $vzdir/share/sql/demo/entities.sql $vzdir/share/sql/demo/properties.sql $vzdir/share/sql/demo/data-demoset1.sql | + cat $vzdir/misc/sql/demo/entities.sql $vzdir/misc/sql/demo/properties.sql $vzdir/misc/sql/demo/data-demoset1.sql | mysql -h$db_host -u$db_admin_user -p$db_admin_pass $db_name fi From 543c0c3de3030f3c91e7c138eae14f0a5a4680d8 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Tue, 28 Dec 2010 01:19:14 +0100 Subject: [PATCH 02/12] updatet default backend path --- htdocs/frontend/javascripts/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/frontend/javascripts/options.js b/htdocs/frontend/javascripts/options.js index 8f24726..de66ab5 100644 --- a/htdocs/frontend/javascripts/options.js +++ b/htdocs/frontend/javascripts/options.js @@ -27,7 +27,7 @@ // default time interval to show vz.options = { language: 'de', - backendUrl: '../backend/index.php', + backendUrl: '../backend.php', tuples: 300, render: 'lines', refresh: false, From 989cea713d00a469086ec06dd751f501f23d4106 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Tue, 28 Dec 2010 01:37:10 +0100 Subject: [PATCH 03/12] re-renamed shell-script, updated path --- misc/tools/{install => install.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename misc/tools/{install => install.sh} (100%) diff --git a/misc/tools/install b/misc/tools/install.sh similarity index 100% rename from misc/tools/install rename to misc/tools/install.sh From 2340233b5bb05da7d589a2146e31bb16d8093f91 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Tue, 28 Dec 2010 01:39:38 +0100 Subject: [PATCH 04/12] updated path --- misc/tools/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/tools/install.sh b/misc/tools/install.sh index a9ab600..aab6de0 100755 --- a/misc/tools/install.sh +++ b/misc/tools/install.sh @@ -134,7 +134,7 @@ if [ "$REPLY" == "y" ]; then echo creating database $db_name... mysql -h$db_host -u$db_admin_user -p$db_admin_pass -e 'CREATE DATABASE `'$db_name'`' pushd $vzdir - php misc/tools/doctrine orm:schema-tool:create + php $dtdir orm:schema-tool:create popd echo "creating db user $db_user with proper rights..." @@ -150,7 +150,7 @@ ask "insert demo data in to database?" n if [ "$REPLY" == "y" ]; then get_admin get_db_name - cat $vzdir/misc/sql/demo/entities.sql $vzdir/misc/sql/demo/properties.sql $vzdir/share/sql/demo/data-demoset1.sql | + cat $vzdir/misc/sql/demo/entities.sql $vzdir/misc/sql/demo/properties.sql $vzdir/misc/sql/demo/data-demoset1.sql | mysql -h$db_host -u$db_admin_user -p$db_admin_pass $db_name fi From cbfa56669d52d3becb6d851403412d1c9ade12ba Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Tue, 28 Dec 2010 19:58:53 +0100 Subject: [PATCH 05/12] updated wiki path --- lib/vendor/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vendor/README b/lib/vendor/README index 154a905..e09147b 100644 --- a/lib/vendor/README +++ b/lib/vendor/README @@ -2,4 +2,4 @@ This directory contains PHP libraries by external developers or projects. Please consult the wiki for detailed instructions: -http://wiki.volkszaehler.org/getstarted +http://wiki.volkszaehler.org/howto/getstarted From f96e38f36b5177f836f8b69075fddb460263e7b3 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Wed, 29 Dec 2010 23:22:09 +0100 Subject: [PATCH 06/12] more path updated...and some clean-ups --- misc/sql/README | 4 +- misc/sql/demo/README | 7 ---- misc/tools/generate_docs.php | 6 +-- misc/tools/import_flo.php | 74 ---------------------------------- misc/tools/import_justin.php | 59 --------------------------- misc/tools/install.php | 78 ------------------------------------ misc/tools/install.sh | 3 +- 7 files changed, 6 insertions(+), 225 deletions(-) delete mode 100644 misc/tools/import_flo.php delete mode 100644 misc/tools/import_justin.php delete mode 100644 misc/tools/install.php diff --git a/misc/sql/README b/misc/sql/README index 2025cd0..8ee7a19 100644 --- a/misc/sql/README +++ b/misc/sql/README @@ -2,9 +2,9 @@ volkszaehler.org uses doctrine [1] as database abstraction and object relation m To setup your database follow these steps: -1. Make sure you have a proper configuration file (backend/volkszaehler.conf.php) +1. Make sure you have a proper configuration file (etc/volkszaehler.conf.php) 2. Adjust the configuration to your database setup -3. Call backend/bin/doctrine orm:schema-tool:create --dump-sql > share/sql/mysql.sql +3. Call misc/tools/doctrine orm:schema-tool:create --dump-sql > misc/sql/mysql.sql 4. import the resulting file using your favorite sql tool Alternatively you can directly import a existing mysql.sql file or diff --git a/misc/sql/demo/README b/misc/sql/demo/README index cc81d88..8108076 100644 --- a/misc/sql/demo/README +++ b/misc/sql/demo/README @@ -1,8 +1 @@ Dieses Verzeichnis enhällt Datenbankdumps mit Daten, die für Demonstrationszwecke genutzt werden könne. - -HOWTO Import pulses.dummy.copy.gz: - -gunzip pulses.dummy.copy.gz -psql -d smartmeter -c "COPY pulses FROM '/var/lib/postgresql/pulses.dummy.copy';" - -or use share/tools/import.php for mysql databases. diff --git a/misc/tools/generate_docs.php b/misc/tools/generate_docs.php index a9fff33..01a4533 100644 --- a/misc/tools/generate_docs.php +++ b/misc/tools/generate_docs.php @@ -41,7 +41,7 @@ . - */ - -$sql = ''; -$pulses = array(); - -// initialize db connection -mysql_connect('localhost', 'vz', 'demo'); -mysql_select_db('volkszaehler_doctrine'); - -// dump => db channel id mapping -$mapping[4] = 22; -$mapping[5] = 23; -$mapping[9] = 24; -$mapping[10] = 25; - -$fd = fopen('/home/steffen/Desktop/testdaten_nicht_veroeffentlichen.sql', 'r'); -if ($fd) { - while (!feof($fd)) { - $line = fgets($fd); - - // $matches index 1 2 3 4 5 6 7 8 - if (preg_match('/^\((\d), \'(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})\', (\d)/', $line, $matches)) { - - $ts = mktime($matches[5], $matches[6], $matches[7], $matches[3], $matches[4], $matches[2]) * 1000; - $value = $matches[8]; - $channel = $mapping[$matches[1]]; - - if ($ts > 0) { - $pulses[] = '(' . $channel . ', ' . $ts . ', ' . $value . ')'; - } - - if (count($pulses) % 1000 == 0) { - $sql = 'INSERT INTO data (channel_id, timestamp, value) VALUES ' . implode(', ', $pulses); - if (!mysql_query($sql)){ - echo mysql_error(); - } - - echo 'Rows inserted: ' . mysql_affected_rows() . '
'; - - flush(); - $pulses = array(); - } - } - }; - - fclose($fd); -} - -?> \ No newline at end of file diff --git a/misc/tools/import_justin.php b/misc/tools/import_justin.php deleted file mode 100644 index 02fc889..0000000 --- a/misc/tools/import_justin.php +++ /dev/null @@ -1,59 +0,0 @@ -. - */ - -$sql = ''; - -$fd = fopen('../docs/developer/pulses.dummy.copy', 'r'); -if ($fd) { - while (!feof($fd)) { - $buffer = explode("\t", fgets($fd)); - - $ts = parsePgSqlTimestamp($buffer[0]); - - if ($ts > 0) - $pulses[] = '(' . (int) ($buffer[2] + 1) . ', ' . $ts . ', 1)'; - }; - - fclose($fd); - - $sql = 'INSERT INTO data (channel_id, timestamp, value) VALUES ' . implode(', ', $pulses); - $dbh->execute($sql); - - echo 'Imported rows: ' . $dbh->affectedRows(); -} -else { - throw new Exception('cant open dump'); -} - -function parsePgSqlTimestamp($timestamp) { - $unix = strtotime($timestamp); - $ms = substr($timestamp, strrpos($timestamp, '.') + 1); - - return $unix + $ms/pow(10, strlen($ms)); -} - -?> \ No newline at end of file diff --git a/misc/tools/install.php b/misc/tools/install.php deleted file mode 100644 index dda5d40..0000000 --- a/misc/tools/install.php +++ /dev/null @@ -1,78 +0,0 @@ -. - */ -?> - - - - - - volkszaehler.org - setup - - -

volkszaehler.org - setup

- -Invalid step during installation: ' . $_GET['step'] . ' -

back

'; - } -} -else { - echo <<Welcome to the installation of your volkszaehler.org!
-This installer will: -
    -
  • check for all requirements
  • -
  • install missing libraries
  • -
  • setup your database + configuration
  • -
  • import your existing data
  • -
  • test your installation
  • -
-Only fundamental administration knowledge is required :) -

-

-So, ready? Take a cup of coffee and lets take a look on your system:

-

Start with step 1: analyze your system

-EOT; -} - -?> - - - \ No newline at end of file diff --git a/misc/tools/install.sh b/misc/tools/install.sh index aab6de0..b6ad86f 100755 --- a/misc/tools/install.sh +++ b/misc/tools/install.sh @@ -87,8 +87,7 @@ fi echo echo volkszaehler setup... -#/var/www/volkszaehler.org -ask "volkszaehler path?" /var/www/vz +ask "volkszaehler path?" /var/www/volkszaehler.org vzdir=$REPLY REPLY=y From 8b65fa8ba25f149d7724657a31c419e59dc8f975 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Thu, 30 Dec 2010 00:16:53 +0100 Subject: [PATCH 07/12] removed screw-up... (yes, path-related...) --- misc/tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/tools/install.sh b/misc/tools/install.sh index b6ad86f..c8ac9ce 100755 --- a/misc/tools/install.sh +++ b/misc/tools/install.sh @@ -133,7 +133,7 @@ if [ "$REPLY" == "y" ]; then echo creating database $db_name... mysql -h$db_host -u$db_admin_user -p$db_admin_pass -e 'CREATE DATABASE `'$db_name'`' pushd $vzdir - php $dtdir orm:schema-tool:create + php misc/tools/doctrine orm:schema-tool:create popd echo "creating db user $db_user with proper rights..." From dbee668637752afc655a26a0acf5f3a6671c6652 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Fri, 31 Dec 2010 12:55:31 +0100 Subject: [PATCH 08/12] relocated default doctrine dir (now that it's final) from /usr/local/volkszaehler.org/doctrine to /usr/local/lib/doctrine --- misc/tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/tools/install.sh b/misc/tools/install.sh index c8ac9ce..1ae7ca1 100755 --- a/misc/tools/install.sh +++ b/misc/tools/install.sh @@ -64,7 +64,7 @@ get_db_name() { echo echo doctrine setup... -ask "doctrine path?" /usr/local/lib/volkszaehler.org/doctrine +ask "doctrine path?" /usr/local/lib/doctrine dtdir=$REPLY REPLY=y From bca162de354d4509318477cbf87111cda39732c8 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Mon, 3 Jan 2011 00:11:19 +0100 Subject: [PATCH 09/12] added a derivative of log_onewire in case you have a 1wire sensor connected to your controller board running ethersex --- misc/controller/bash/log_onewire_ecmd.sh | 58 ++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 misc/controller/bash/log_onewire_ecmd.sh diff --git a/misc/controller/bash/log_onewire_ecmd.sh b/misc/controller/bash/log_onewire_ecmd.sh new file mode 100755 index 0000000..3fba742 --- /dev/null +++ b/misc/controller/bash/log_onewire_ecmd.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# +# This is a simple bash script to read Dallas 1-Wire sensors +# connected to a controller board running ethersex and log their +# values to the volkszaehler project. +# +# call it with a cronjob similiar to this one: +# +# */5 * * * * ~/bin/log1wire_ecmd.sh +# +# @copyright Copyright (c) 2010, The volkszaehler.org project +# @package controller +# @license http://www.opensource.org/licenses/gpl-license.php GNU Public License +# @author Justin Otherguy +# @author Steffen Vogel +# +## +# This file is part of volkzaehler.org +# +# volkzaehler.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# volkzaehler.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with volkszaehler.org. If not, see . +## + +# configuration +# +# backend url +URL="http://volkszaehler.org/neu/backend/index.php" + +# sensor settings +# id of the sensor +SENSORID=10a5d600020800b7 +# ip address of the controller board running ethersex +ESEXIP=192.168.111.56 +# uuid of the sensor in the volkszaehler database +UUID=0f2636b4-12cf-c086-50da-348fab30ece6 + +## +# paths to binaries - you should not need to change these +CURL=/usr/bin/curl +NC=/bin/nc + + +# ========= do not change anything below this line ============== + +echo "1w convert $SENSORID" |$NC $ESEXIP 2701 -q 1 2>/dev/null | grep -qe OK || exit 1 +TEMPERATURE=`echo 1w get $SENSORID | nc $ESEXIP 2701 -q 1 2>/dev/null | sed -e 's/Temperatur: //'` + +$CURL --data "" "$URL/data/$UUID.json?value=$TEMPERATURE" From 0337d8d542d3fa31a487f8a22496b46c3d8ff9cf Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Mon, 3 Jan 2011 00:33:02 +0100 Subject: [PATCH 10/12] cleaned up file names (and self-references inside the files) --- misc/controller/bash/{log_onewire => log_onewire.sh} | 0 misc/controller/bash/log_onewire_ecmd.sh | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename misc/controller/bash/{log_onewire => log_onewire.sh} (100%) diff --git a/misc/controller/bash/log_onewire b/misc/controller/bash/log_onewire.sh similarity index 100% rename from misc/controller/bash/log_onewire rename to misc/controller/bash/log_onewire.sh diff --git a/misc/controller/bash/log_onewire_ecmd.sh b/misc/controller/bash/log_onewire_ecmd.sh index 3fba742..72fef7b 100755 --- a/misc/controller/bash/log_onewire_ecmd.sh +++ b/misc/controller/bash/log_onewire_ecmd.sh @@ -6,7 +6,7 @@ # # call it with a cronjob similiar to this one: # -# */5 * * * * ~/bin/log1wire_ecmd.sh +# */5 * * * * ~/bin/log_onewire_ecmd.sh # # @copyright Copyright (c) 2010, The volkszaehler.org project # @package controller From df247e40cad6c59db3f59c6b24711e1a96980d9e Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Mon, 3 Jan 2011 00:33:26 +0100 Subject: [PATCH 11/12] more cleanups --- misc/controller/bash/log_onewire.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/controller/bash/log_onewire.sh b/misc/controller/bash/log_onewire.sh index de497c6..aeab12c 100755 --- a/misc/controller/bash/log_onewire.sh +++ b/misc/controller/bash/log_onewire.sh @@ -5,7 +5,7 @@ # # call it with a cronjob similiar to this one: # -# */5 * * * * ~/bin/log1wire.sh +# */5 * * * * ~/bin/log_onewire.sh # # @copyright Copyright (c) 2010, The volkszaehler.org project # @package controller From d2e3facea2beadca226b030b775dd6d0c397dbfe Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Mon, 3 Jan 2011 00:49:46 +0100 Subject: [PATCH 12/12] generalized variables --- misc/controller/bash/log_onewire_ecmd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/controller/bash/log_onewire_ecmd.sh b/misc/controller/bash/log_onewire_ecmd.sh index 72fef7b..712ba79 100755 --- a/misc/controller/bash/log_onewire_ecmd.sh +++ b/misc/controller/bash/log_onewire_ecmd.sh @@ -38,11 +38,11 @@ URL="http://volkszaehler.org/neu/backend/index.php" # sensor settings # id of the sensor -SENSORID=10a5d600020800b7 +SENSORID= # ip address of the controller board running ethersex -ESEXIP=192.168.111.56 +ESEXIP= # uuid of the sensor in the volkszaehler database -UUID=0f2636b4-12cf-c086-50da-348fab30ece6 +UUID= ## # paths to binaries - you should not need to change these