<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hallo Ludger,<br>
<br>
hier findest Du meine notizen und unten ein script mit dem ich
gerade experimentiere. Bitte gib mir feedback dazu. Kannst mich auch
gerne per Telefon anrufen- Angaben sind<br>
unten in der Signature.<br>
<br>
Wenn die Infos was taugen würde ich sie gerne auf die Wikiseite
bringen - was muss ich dafür tun?<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<h3><span class="mw-headline" id="Udo.27s_Lesekopf">Udo's Lesekopf </span></h3>
<ul>
<li> Bus 001 Device 012: ID 10c4:ea60 Cygnal Integrated Products,
Inc. CP210x UART Bridge / myAVR mySmartUSB light
</li>
</ul>
<h3> <span class="mw-headline" id="Middleware"> Middleware </span></h3>
<ul>
<li> <a rel="nofollow" class="external free"
href="http://wiki.volkszaehler.org/software/middleware/installation">http://wiki.volkszaehler.org/software/middleware/installation</a>
</li>
</ul>
<pre>apt-get update
sudo apt-get install git-core libapache2-mod-php5 php5-cli php5-mysql php-apc mysql-server mysql-client
sudo bash install.sh
</pre>
<p>and apache configuration<br>
anschliessend geht:<br>
</p>
<p><a rel="nofollow" class="external free"
href="http://rpi.bitplan.com">http://rpi.bitplan.com</a>
<br>
</p>
<p>add S0-Impulszähler 10000 Impulse pro kwh
</p>
<h3> <span class="mw-headline" id="uuids"> uuids </span></h3>
<pre>mysql> select * from entities;
+----+--------------------------------------+-------+---------+
| id | uuid | type | class |
+----+--------------------------------------+-------+---------+
| 1 | a301d8d0-903b-1234-94bb-d943d061b6a8 | power | channel |
| 2 | 38c6fb60-d9f9-11e3-aa75-7509b3b28371 | power | channel |
| 3 | 89f3ff60-da16-11e3-9b7d-615684429384 | power | channel |
| 4 | f2184180-da16-11e3-9709-7f3f3c090c10 | power | channel |
+----+--------------------------------------+-------+---------+
</pre>
<p>38c6fb60-d9f9-11e3-aa75-7509b3b28371 is the S0-Impuls for the
digital meter
</p>
<h3> <span class="mw-headline" id="vzlogger"> vzlogger </span></h3>
<ul>
<li> <a rel="nofollow" class="external free"
href="http://www.goller-online.de/index.php/raspberry-pi/vzlogger/91-vzlogger-mit-apt-get-installieren">http://www.goller-online.de/index.php/raspberry-pi/vzlogger/91-vzlogger-mit-apt-get-installieren</a>
</li>
</ul>
<pre>Ihr könnt das einbinden, indem Ihr folgenden Eintrag zu /etc/apt/sources.list hinzufügt:
deb <a class="moz-txt-link-freetext" href="http://packages.volkszaehler.org/vz/">http://packages.volkszaehler.org/vz/</a> wheezy main
Damit die Prüfung der Paket-Signatur klappt, müsst Ihr den Signierschlüssel importieren (als root):
wget -O- <a class="moz-txt-link-freetext" href="http://packages.volkszaehler.org/vz/justinotherguy.asc">http://packages.volkszaehler.org/vz/justinotherguy.asc</a> | apt-key add -
Jetzt noch ein
apt-get update
und ein
apt-get install vzlogger
- das war's.
Entpacken von vzlogger (aus .../vzlogger_0.3.3-rc3_armhf.deb)
</pre>
<h4> <span class="mw-headline" id="vzlogger_konfigurieren">
vzlogger konfigurieren </span></h4>
<ul>
<li> <a rel="nofollow" class="external free"
href="http://www.lexxi.at/2013/05/02/start-und-kontrolle-von-vzlogger/">http://www.lexxi.at/2013/05/02/start-und-kontrolle-von-vzlogger/</a>
</li>
<li> <a rel="nofollow" class="external free"
href="http://wiki.volkszaehler.org/howto/emh_pv-anlage">http://wiki.volkszaehler.org/howto/emh_pv-anlage</a>
</li>
</ul>
<pre>udevadm info --query=all --name=/dev/ttyUSB0 | grep -i serial_short
E: ID_SERIAL_SHORT=0079E5B9
</pre>
<h2> <span class="mw-headline" id="Troubleshooting">
Troubleshooting </span></h2>
<h3> <span class="mw-headline" id="get_rid_of_invalid_data"> get
rid of invalid data </span></h3>
<pre>mysql> select count(*),channel_id from data group by channel_id order by 1 desc;
+----------+------------+
| count(*) | channel_id |
+----------+------------+
| 21345 | 1 |
| 575 | 3 |
| 575 | 4 |
+----------+------------+
mysql> delete from data where channel_id>1;
</pre>
<h3> <span class="mw-headline" id="Z.C3.A4hler"> Zähler </span></h3>
<ul>
<li> <a rel="nofollow" class="external free"
href="http://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/edl21-ehz">http://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/edl21-ehz</a>
</li>
<li> <a rel="nofollow" class="external free"
href="http://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/emh-ehz-h1">http://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/emh-ehz-h1</a>
</li>
</ul>
<br>
hier findest Du ein Script, dass ich gerade auf dem raspberry teste<br>
<br>
#!/bin/bash<br>
# install script for vzlogger<br>
# WF 2014-05-12<br>
# $Header:
/media/fdf64846-7c1a-4a44-8ef6-b4f9177e893e/home/wf/volkszaehler/RCS/vzlinstall.sh,v
1.10 2014/05/13 07:07:43 wf Exp wf $<br>
#set -x<br>
<br>
#<br>
# error<br>
#<br>
error() {<br>
local l_msg="$1"<br>
local l_hint="$2"<br>
echo "error: $l_msg" 1>&2<br>
echo " you might want to $l_hint" 1>&2<br>
exit 1<br>
}<br>
<br>
#<br>
# install vzlogger from debian package<br>
#<br>
vzlogger_install() {<br>
vzl=`which vzlogger`<br>
if [ $? -eq 0 ]<br>
then<br>
echo "vzlogger is already installed at $vzl"<br>
return <br>
fi<br>
package="deb <a class="moz-txt-link-freetext" href="http://packages.volkszaehler.org/vz/">http://packages.volkszaehler.org/vz/</a> wheezy main"<br>
srclist=/etc/apt/sources.list<br>
<br>
# check that source.list exists<br>
if [ ! -f $srclist ]<br>
then<br>
error "$srclist is missing" "install apt"<br>
fi<br>
<br>
# check that package.volkszaehler.org ist in source.list<br>
grep "$package" $srclist > /dev/null<br>
# if not we need to add it<br>
if [ $? -ne 0 ]<br>
then<br>
echo "adding $package to $scrlist ..."<br>
sudo echo "$package" >> $scrlist<br>
echo "importing key for apt"<br>
sudo wget -O-
<a class="moz-txt-link-freetext" href="http://packages.volkszaehler.org/vz/justinotherguy.asc">http://packages.volkszaehler.org/vz/justinotherguy.asc</a> | apt-key add
-<br>
echo "running apt-get update"<br>
sudo apt-get update<br>
echo "installing vzlogger"<br>
sudo apt-get install vzlogger<br>
else<br>
error "vzlogger not available but $scrlist already modified"
"check apt-get update/install"<br>
fi<br>
}<br>
<br>
#<br>
# add udev rules to the given udev rules file<br>
# param 1: the rules file<br>
# param 2: the serial number<br>
# param 3: the usb number<br>
#<br>
addrules() {<br>
local l_rules="$1"<br>
local l_serial="$2"<br>
local l_usb="$3"<br>
local l_symlink="usb-ir-lesekopf$l_usb"<br>
echo "adding rule for $l_serial/USB$l_usb to $l_rules"<br>
echo 'SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="'$l_serial'",
SYMLINK+="'$l_symlink'"' >> "$l_rules"<br>
udevadm trigger<br>
ls -la /dev/$l_symlink<br>
if [ ! -h /dev/$l_symlink ]<br>
then<br>
error "symbolic link $l_symlink was not created" "check udevadm
trigger worked"<br>
fi<br>
}<br>
<br>
<br>
#<br>
# configure udevrules for vzlogger<br>
#<br>
vzlogger_udevrules() {<br>
rules=/etc/udev/rules.d/99-usb-ir-lesekopf.rules<br>
lsusb | grep CP210x<br>
if [ $? -ne 0 ]<br>
then<br>
error "no CP210x USB device found" "check Lesekopf/USB
connected"<br>
else<br>
# check IR Lesekopf<br>
for usb in 0 1<br>
do<br>
query="udevadm info --query=all --name=/dev/ttyUSB$usb"<br>
$query 2>&1 | grep -i serial_short > /dev/null <br>
if [ $? -eq 0 ] <br>
then<br>
serial=`$query | grep -i serial_short | cut -f2 -d=`<br>
echo "device with serial $serial at USB$usb"<br>
if [ ! -f $rules ]<br>
then <br>
addrules $rules $serial $usb<br>
else<br>
grep $serial $rules > /dev/null<br>
if [ $? -ne 0 ]<br>
then<br>
addrules $rules $serial $usb<br>
else<br>
echo "$serial/USB$usb already installed in udev rules"<br>
fi<br>
fi<br>
fi<br>
done<br>
fi<br>
}<br>
<br>
#<br>
# stty settings for the given usb device<br>
#<br>
stty_usb() {<br>
local l_usb="$1" <br>
stty -F /dev/ttyUSB$l_usb
1:0:8bd:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0<br>
}<br>
<br>
#<br>
# test the given usb device<br>
#<br>
test_usb() {<br>
local l_usb="$1" <br>
local l_expected="1b 1b 1b 1b"<br>
stty_usb $l_usb<br>
timeout 2 cat /dev/ttyUSB$l_usb | od -tx1 | grep "$l_expected"<br>
if [ $? -eq 0 ]<br>
then<br>
echo "USB$l_usb sends expected data $l_expected"<br>
else<br>
error "USB$l_usb sends unexpected data" "check stty settings"<br>
fi<br>
}<br>
<br>
#<br>
# vzlogger test<br>
#<br>
vzlogger_test() {<br>
cat << EOF<br>
/**<br>
* vzlogger configuration<br>
* <br>
* use proper encoded JSON with javascript comments<br>
*<br>
* take a look at the wiki for detailed information:<br>
*
<a class="moz-txt-link-freetext" href="http://wiki.volkszaehler.org/software/controller/vzlogger#configuration">http://wiki.volkszaehler.org/software/controller/vzlogger#configuration</a><br>
*/<br>
<br>
{<br>
"retry" : 30, /* how long to sleep between failed
requests, in seconds */<br>
"daemon": false, /* run periodically */<br>
"foreground" : true, /* dont run in background (prevents
forking) */<br>
<br>
"verbosity" : 15, /* between 0 and 15 */<br>
"log" : "/var/log/vzlogger.log",/* path to logfile, optional */<br>
<br>
"local" : {<br>
"enabled" : false, /* should we start the local HTTPd
for serving live readings? */<br>
"port" : 8080, /* the TCP port for the local
HTTPd */<br>
"index" : true, /* should we provide a index listing
of available channels? */<br>
"timeout" : 30, /* timeout for long polling comet
requests, 0 disables comet, in seconds */<br>
"buffer" : 600 /* how long to buffer readings for
the local interface, in seconds */<br>
},<br>
<br>
"meters" : [{<br>
"enabled" : true, /* disabled meters will be ignored
*/<br>
"protocol" : "sml", /* use 'vzlogger -h' for list of
available protocols */<br>
"device" : "/dev/usb-ir-lesekopf0",<br>
}<br>
]}<br>
EOF<br>
}<br>
<br>
#<br>
# test the device<br>
#<br>
vzlogger_test() {<br>
local l_usb="$1"<br>
test_usb $l_usb<br>
tst_conf=/etc/vzlogger.test<br>
if [ ! -f $tst_conf ]<br>
then<br>
# only usb0 <br>
echo "creating $tst_conf (only USB$l_usb!)"<br>
vzlogger_test > $tst_conf <br>
else<br>
echo "$tst_conf already exists"<br>
fi<br>
timeout 5 vzlogger -c $tst_conf <br>
}<br>
<br>
#<br>
# output a vzlogger configuration<br>
#<br>
vzlogger_config() {<br>
local l_mode="$1"<br>
local l_uuid="$2"<br>
local l_id="$3"<br>
local l_comment="$4"<br>
local l_delim="$5"<br>
case $l_mode in<br>
header)<br>
cat << EOF<br>
/**<br>
* vzlogger configuration<br>
*<br>
* use proper encoded JSON with javascript comments<br>
*<br>
* take a look at the wiki for detailed information:<br>
*
<a class="moz-txt-link-freetext" href="http://wiki.volkszaehler.org/software/controller/vzlogger#configuration">http://wiki.volkszaehler.org/software/controller/vzlogger#configuration</a><br>
*/<br>
{<br>
"retry" : 30, /* how long to sleep between failed requests, in
seconds */<br>
"daemon": true, /* run as server */<br>
//"foreground" : true, /* dont run in background (prevents
forking) */<br>
"verbosity" : 5, /* between 0 and 15 */<br>
"log" : "/var/log/vzlogger.log", /* path to logfile, optional */<br>
<br>
"local" : {<br>
"enabled" : true, /* should we start the local HTTPd for serving
live readings? */<br>
"port" : 8080, /* the TCP port for the local HTTPd */<br>
"index" : true, /* should we provide a index listing of
available channels if no UUID was requested? */<br>
"timeout" : 30, /* timeout for long polling comet requests, 0
disables comet, in seconds */<br>
"buffer" : 600 /* how long to buffer readings for the local
interface, in seconds */<br>
},<br>
<br>
"meters" : [{<br>
"enabled" : true, /* disabled meters will be ignored */<br>
"protocol" : "sml", /* see 'vzlogger -h' for list of available
prot$ */<br>
"device" : "/dev/usb-ir-lesekopf0",<br>
"channels": [<br>
EOF<br>
;;<br>
channel)<br>
cat << EOF<br>
$l_delim{<br>
"uuid" : "$l_uuid",<br>
"middleware" : <a class="moz-txt-link-rfc2396E" href="http://localhost/middleware.php">"http://localhost/middleware.php"</a>,<br>
"identifier" : "1-0:$l_id", /* $l_comment */<br>
}<br>
EOF<br>
;;<br>
footer)<br>
cat << EOF<br>
]<br>
}<br>
]}<br>
EOF<br>
;;<br>
esac<br>
}<br>
<br>
#<br>
# configure vzlogger<br>
#<br>
vzlogger_configure() {<br>
vz_conf=/etc/vzlogger.conf <br>
if [ ! -f $vz_conf ]<br>
then<br>
# only usb0 <br>
echo "creating $vz_conf (only USB$l_usb!)"<br>
vzlogger_config header > $vz_conf<br>
local l_delim=""<br>
while read l_uuid l_id l_comment<br>
do<br>
vzlogger_config channel $l_uuid $l_id $l_comment $l_delim
>> $vz_conf <br>
l_delim=", "<br>
done<br>
vzlogger_config footer >> $vz_conf<br>
else<br>
echo "$vz_conf already exists"<br>
fi<br>
}<br>
<br>
#<br>
# get the sqlquery<br>
#<br>
sql_query() {<br>
cat << EOF<br>
select e.uuid,p.value from entities e join properties p on
e.id=p.entity_id where pkey='title';<br>
EOF<br>
}<br>
<br>
# <br>
# configure vzlogger<br>
#<br>
configure() {<br>
rm /etc/vzlogger.conf<br>
# configure vzlogger<br>
# anpassen!<br>
cat << EOF | vzlogger_configure<br>
949808f0-da6f-11e3-9d0e-6757e6f50dbd 15.7.0 Haus-15.7.0_Wirkleistung<br>
4e57e880-da74-11e3-8ea0-2743cd8e7e3f 1.8.0 Haus-1.8.0_EVU_Bezug<br>
f2184180-da16-11e3-9709-7f3f3c090c10 2.8.0
Haus-2.8.0_PV_Einspeisung<br>
b657c960-da69-11e3-be9c-830351251385 2.7.0 Haus-2.7.0-Leistung<br>
EOF<br>
# efaaee80-da67-11e3-9d0e-f36cf67c5b5b 16.7.0 "Leistung_Verbrauch"<br>
# b657c960-da69-11e3-be9c-830351251385 2.7.0 "Leistung_Lieferung"<br>
}<br>
<br>
restart() {<br>
pid=`pgrep -l vzlogger`<br>
if [ $? -eq 0 ]<br>
then<br>
echo "killing vzlogger $pid"<br>
pkill vzlogger <br>
fi<br>
vzlogger<br>
}<br>
<br>
# auskommentieren was Du brauchst!<br>
# first install vzlogger / check if it is already installed<br>
vzlogger_install<br>
# configure vzlogger<br>
vzlogger_udevrules<br>
# test the usb devices directly and with vzlogger <br>
vzlogger_test 0<br>
sql_query | mysql -u vz --password='demo' volkszaehler<br>
#uuid value<br>
#38c6fb60-d9f9-11e3-aa75-7509b3b28371 S0-Impulse<br>
#949808f0-da6f-11e3-9d0e-6757e6f50dbd Haus 15.7.0 Wirkleistung<br>
#a301d8d0-903b-1234-94bb-d943d061b6a8 S0-Zaehler<br>
#b657c960-da69-11e3-be9c-830351251385 Haus 2.7.0 Leistung<br>
#efaaee80-da67-11e3-9d0e-f36cf67c5b5b Haus 16.7.0 Leistung<br>
#f2184180-da16-11e3-9709-7f3f3c090c10 Haus 2.8.0 (Lieferung -A)<br>
#stty_usb 0<br>
#service vzlogger start<br>
<br>
<div class="moz-cite-prefix">Am 10.05.14 17:50, schrieb Ludger
Bremenkamp:<br>
</div>
<blockquote
cite="mid:000601cf6c67$9de1b580$d9a52080$@ludger@t-online.de"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hallo zusammen,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">ich möchte meinen Landis&Gyr
ZMD120APECS mit der Raspberry Pi Erweiterung + Lesekopf von
Udo auslesen und suche nach einer Anleitung!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Ich kann im Netz nichts finden hat jemand
einen Link oder eine Anleitung!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Danke!!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Grüße Ludger<o:p></o:p></p>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
BITPlan - smart solutions
Wolfgang Fahl
Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
Tel. +49 2154 811-480, Fax +49 2154 811-481
Web: <a class="moz-txt-link-freetext" href="http://www.bitplan.de">http://www.bitplan.de</a>
BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl </pre>
</body>
</html>