From e5c9902a4c1279461b1c5f548011d89c24f67063 Mon Sep 17 00:00:00 2001 From: SvenPeitz Date: Thu, 3 Mar 2011 21:54:58 +0100 Subject: [PATCH 1/2] closes #59 --- misc/controller/bash/log_i2c_ds1631_ecmd.sh | 58 +++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 misc/controller/bash/log_i2c_ds1631_ecmd.sh diff --git a/misc/controller/bash/log_i2c_ds1631_ecmd.sh b/misc/controller/bash/log_i2c_ds1631_ecmd.sh new file mode 100755 index 0000000..c7513db --- /dev/null +++ b/misc/controller/bash/log_i2c_ds1631_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_i2c_ds1631_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 +# @author Sven Peitz +## +# 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://192.168.10.1/backend" + +# sensor settings +# Sensor 0x48 (72) ist bei ds1631 sensorid = 0 warum auch immer? +# folglich ist sensor 0x4d (75) sensorid = 3 usw. +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 "ds1631 convert $SENSORID 1" |$NC $ESEXIP 2701 -q 1 2>/dev/null | grep -qie OK || exit 1 +TEMPERATURE=`echo ds1631 temp $SENSORID | $NC $ESEXIP 2701 -q 1 2>/dev/null | sed -e 's/Temperatur: //'` + +$CURL --data "" "$URL/data/$UUID.json?value=$TEMPERATURE" From 7b0b6d8a50dab8c41602350764d4dd8337e30971 Mon Sep 17 00:00:00 2001 From: SvenPeitz Date: Thu, 3 Mar 2011 22:22:32 +0100 Subject: [PATCH 2/2] fixed TEMPERATURE=`echo 1w get $SENSORID | nc $ESEXIP 2701 -q 1 2>/dev/null | sed -e 's/Temperatur: //'` to TEMPERATURE=`echo 1w get $SENSORID | $NC $ESEXIP 2701 -q 1 2>/dev/null | sed -e 's/Temperatur: //'` --- misc/controller/bash/log_onewire_ecmd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/controller/bash/log_onewire_ecmd.sh b/misc/controller/bash/log_onewire_ecmd.sh index 712ba79..c611661 100755 --- a/misc/controller/bash/log_onewire_ecmd.sh +++ b/misc/controller/bash/log_onewire_ecmd.sh @@ -38,7 +38,7 @@ URL="http://volkszaehler.org/neu/backend/index.php" # sensor settings # id of the sensor -SENSORID= +SENSORID= # ip address of the controller board running ethersex ESEXIP= # uuid of the sensor in the volkszaehler database @@ -53,6 +53,6 @@ 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: //'` +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"