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, 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 diff --git a/misc/controller/bash/log_onewire b/misc/controller/bash/log_onewire.sh similarity index 98% rename from misc/controller/bash/log_onewire rename to misc/controller/bash/log_onewire.sh index de497c6..aeab12c 100755 --- a/misc/controller/bash/log_onewire +++ 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 diff --git a/misc/controller/bash/log_onewire_ecmd.sh b/misc/controller/bash/log_onewire_ecmd.sh new file mode 100755 index 0000000..712ba79 --- /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/log_onewire_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= +# ip address of the controller board running ethersex +ESEXIP= +# uuid of the sensor in the volkszaehler database +UUID= + +## +# 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" 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 b/misc/tools/install.sh similarity index 95% rename from misc/tools/install rename to misc/tools/install.sh index a9ab600..1ae7ca1 100755 --- a/misc/tools/install +++ 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 @@ -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 @@ -150,7 +149,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