<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hallo Christian,</p>
<p>leider noch keine Verbesserung:</p>
<p><i><b>pi@raspberrypi:~ $ sudo /test01.py</b></i><i><b><br>
</b></i><i><b> File "/test01.py", line 23</b></i><i><b><br>
</b></i><i><b> time.sleep(30.0)</b></i><i><b><br>
</b></i><i><b> ^</b></i><i><b><br>
</b></i><i><b>SyntaxError: invalid syntax</b></i></p>
<p>Die von Dir erwähnte Script-Zeilen sehen momentan so aus:</p>
<p> <i><b>db = MySQLdb.connect(host=mysqlHost,
port=int(mysqlPort), user=mysqlLogin, passwd=mysqlPass)</b></i><i><b><br>
</b></i><i><b> cursor = db.cursor()</b></i><i><b><br>
</b></i><i><b> cursor.execute("INSERT INTO
data(channel_id(34)) (timestamp, value) VALUES (%s,%s);",
(Timestamp, str(input))</b></i><i><b><br>
</b></i><i><b> time.sleep(30.0)</b></i></p>
<p>Vielleicht noch eine Idee - Grüße und Danke!<br>
</p>
<br>
<div class="moz-cite-prefix">Am 07.10.2016 um 08:33 schrieb
Christian Schnellrieder:<br>
</div>
<blockquote
cite="mid:CAFse7xQXv8GpDbS64gs0pAkHtwOfRD5dsY_Qx_nxVP15iCrg6A@mail.gmail.com"
type="cite">
<div dir="ltr">Hallo.
<div><br>
</div>
<div>time.sleep einfach rein rücken.</div>
<div><br>
</div>
<div><b class="gmail_msg"
style="color:rgb(33,33,33);font-family:"helvetica
neue",helvetica,arial,sans-serif"><i class="gmail_msg">
cursr.execute("INSERT INTO data(channel_id(34))
(timestamp, value) VALUES (%s,%s);", (Timestamp,
str(input))</i></b><b class="gmail_msg"
style="color:rgb(33,33,33);font-family:"helvetica
neue",helvetica,arial,sans-serif"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"
style="color:rgb(33,33,33);font-family:"helvetica
neue",helvetica,arial,sans-serif"><i class="gmail_msg">
time.sleep(30.0)</i></b> <br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>und nicht<br>
</div>
<div><br>
</div>
<div><b class="gmail_msg"
style="color:rgb(33,33,33);font-family:"helvetica
neue",helvetica,arial,sans-serif"><i class="gmail_msg">
cursr.execute("INSERT INTO data(channel_id(34))
(timestamp, value) VALUES (%s,%s);", (Timestamp,
str(input))</i></b><b class="gmail_msg"
style="color:rgb(33,33,33);font-family:"helvetica
neue",helvetica,arial,sans-serif"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"
style="color:rgb(33,33,33);font-family:"helvetica
neue",helvetica,arial,sans-serif"><i class="gmail_msg">
time.sleep(30.0)</i></b> </div>
<div><br>
</div>
<div><br>
</div>
<div>Grüße<br>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">Andreas Götz <<a moz-do-not-send="true"
href="mailto:cpuidle@gmail.com">cpuidle@gmail.com</a>>
schrieb am Fr., 7. Okt. 2016 um 07:38 Uhr:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="auto" class="gmail_msg">
<div class="gmail_msg">Google ist Dein Freund- hat nix mit
VZ zu tun:</div>
<div id="m_-4407505707927402449AppleMailSignature"
class="gmail_msg"><br class="gmail_msg">
</div>
<div id="m_-4407505707927402449AppleMailSignature"
class="gmail_msg"><a moz-do-not-send="true"
href="http://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python"
class="gmail_msg" target="_blank">http://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python</a><br
class="gmail_msg">
<br class="gmail_msg">
Viele Grüße,
<div class="gmail_msg">Andreas</div>
</div>
</div>
<div dir="auto" class="gmail_msg">
<div class="gmail_msg"><br class="gmail_msg">
Am 07.10.2016 um 01:37 schrieb Torsten <<a
moz-do-not-send="true" href="mailto:t.wisgalla@gmx.de"
class="gmail_msg" target="_blank">t.wisgalla@gmx.de</a>>:<br
class="gmail_msg">
<br class="gmail_msg">
</div>
<blockquote type="cite" class="gmail_msg">
<div class="gmail_msg">
<p class="gmail_msg">Hallo zusammen,</p>
<p class="gmail_msg">habe nun nach längerem Studium
dieses kleine Python-Script geschrieben, welcher bis
zur print-Ausgabe des PUMP-STATUS(alle 30sec) auch
funktioniert:<br class="gmail_msg">
</p>
<p class="gmail_msg"><b class="gmail_msg"><i
class="gmail_msg">#!/usr/bin/python</i></b><b
class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">mysqlHost
= '127.0.0.1'</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">mysqlPort
= '3306'</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">mysqlLogin
= 'root'</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">mysqlPass
= 'raspberry'</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">mysqlDatabase
= "volkszaehler"</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">import
RPi.GPIO as GPIO</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">import
sys, time, os, re</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">import
MySQLdb</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">GPIO.setmode(GPIO.BOARD)</i></b><b
class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">GPIO.setup(29,
<a moz-do-not-send="true" href="http://GPIO.IN"
class="gmail_msg" target="_blank">GPIO.IN</a>)</i></b><b
class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">while
True:</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
input = GPIO.input(29)</i></b><b
class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
print("PUMP-STATUS: " + str(input))</i></b><b
class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
db = MySQLdb.connect(host=mysqlHost,
port=int(mysqlPort), user=mysqlLogin,
passwd=mysqlPass)</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
cursor = db.cursor()</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
cursor.execute("INSERT INTO data(channel_id(34))
(timestamp, value) VALUES (%s,%s);", (Timestamp,
str(input))</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
time.sleep(30.0)</i></b></p>
<p class="gmail_msg">Problem ist jetzt die Übertragung
des Status in die Datenbank. Wenn ich das Script
jetzt starte kommt folgendes:</p>
<b class="gmail_msg"><i class="gmail_msg">pi@raspberrypi:~
$ sudo /test01.py</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
File "/test01.py", line 23</i></b><b
class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
time.sleep(30.0)</i></b><b class="gmail_msg"><i
class="gmail_msg"><br class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">
^</i></b><b class="gmail_msg"><i class="gmail_msg"><br
class="gmail_msg">
</i></b><b class="gmail_msg"><i class="gmail_msg">SyntaxError:
invalid syntax</i></b> <br class="gmail_msg">
<br class="gmail_msg">
Können die Profis helfen? Wollte es eben gerne selbst
versuchen - jetzt wird die Luft aber immer dünner.<br
class="gmail_msg">
<br class="gmail_msg">
MfG und besten Dank - Torsten<br class="gmail_msg">
<p class="gmail_msg"><br class="gmail_msg">
</p>
<br class="gmail_msg">
<div class="m_-4407505707927402449moz-cite-prefix
gmail_msg">Am 09.09.2016 um 23:16 schrieb Torsten
Wisgalla:<br class="gmail_msg">
</div>
<blockquote type="cite" class="gmail_msg">
<div
class="m_-4407505707927402449mail_android_message
gmail_msg" style="line-height:1;padding:0.5em">Hi
Christian, die Pumpe(GPIO) war auch nach 18:47
noch an! Und die erneute Anzeige, dass sie wieder
an ist(18:48) ist nur dadurch zu Stande gekommen,
dass ich den GPIO einmal ganz kurz aus- und wieder
angeschaltet habe. Zu beachten ist ebenfalls, das
Intervall: 60, eingestellt ist - also der Graph
zeitlich verzögert dargestellt wird.<br
class="gmail_msg">
Dazu bitte meine vorletzte Mail lesen!<br
class="gmail_msg">
MfG - Torsten <br class="gmail_msg">
-- <br class="gmail_msg">
Diese Nachricht wurde von meinem Android
Mobiltelefon mit GMX Mail gesendet.</div>
<div class="m_-4407505707927402449mail_android_quote
gmail_msg" style="line-height:1;padding:0.3em">Am
09.09.16, 11:58, Christian Schnellrieder <<a
moz-do-not-send="true"
href="http://schnellrieder.cs" class="gmail_msg"
target="_blank">schnellrieder.cs</a>@<a
moz-do-not-send="true" href="http://gmail.com"
class="gmail_msg" target="_blank">gmail.com</a>>
schrieb:
<blockquote class="gmail_quote gmail_msg"
style="margin:0.8ex 0pt 0pt
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div class="gmail_msg"> Aber das sagt die Grafik
aus...
<div class="gmail_msg"> Zwischen 18:46 und
18:47 war die Pumpe an. Ab 18:48 an... dauer
noch unbekannt bis zum nächsten Wechsel. </div>
<div class="gmail_msg"> <br class="gmail_msg">
</div>
<div class="gmail_msg"> <br class="gmail_msg">
</div>
<div class="gmail_msg"> Grüße </div>
</div>
<br class="gmail_msg">
<div class="gmail_quote gmail_msg">
<div class="gmail_msg"> Torsten Wisgalla <<a
moz-do-not-send="true"
href="mailto:t.wisgalla@gmx.de"
class="gmail_msg" target="_blank">t.wisgalla@gmx.de</a>>
schrieb am Fr., 9. Sep. 2016 um 11:46 Uhr:<br
class="gmail_msg">
</div>
<blockquote class="gmail_quote gmail_msg"
style="margin:0 0 0 0.8ex;border-left:1.0px
rgb(204,204,204) solid;padding-left:1.0ex">
<div class="gmail_msg">
<div class="gmail_msg">
<div style="line-height:1;padding:0.5em"
class="gmail_msg"> Das nach Ende des
Rechtecks der GPIO immer noch an war.
Der Graph würde nur auf 1 bleiben,
wenn der GPIO ständig gelpulst würde.<br
class="gmail_msg">
Haben wir, denke ich geklärt - vz kann
momentan über GPIO nur Impulse - keine
Dauersignale.<br class="gmail_msg">
Gruß Torsten<br class="gmail_msg">
--<br class="gmail_msg">
Diese Nachricht wurde von meinem
Android Mobiltelefon mit GMX Mail
gesendet. </div>
<div style="line-height:1;padding:0.3em"
class="gmail_msg"> </div>
</div>
</div>
<div class="gmail_msg">
<div class="gmail_msg">
<div style="line-height:1;padding:0.3em"
class="gmail_msg"> Am 09.09.16, 09:22,
Christian Schnellrieder <<a
moz-do-not-send="true"
href="http://schnellrieder.cs"
class="gmail_msg" target="_blank">schnellrieder.cs</a>@<a
moz-do-not-send="true"
href="http://gmail.com"
class="gmail_msg" target="_blank">gmail.com</a>>
schrieb: </div>
</div>
</div>
<div class="gmail_msg">
<div class="gmail_msg">
<div style="line-height:1;padding:0.3em"
class="gmail_msg">
<blockquote class="gmail_quote
gmail_msg" style="margin:0.8ex 0.0pt
0.0pt 0.8ex;border-left:1.0px solid
rgb(204,204,204);padding-left:1.0ex">
<div class="gmail_msg"> Hallo
Torsten.
<div class="gmail_msg"> <br
class="gmail_msg">
</div>
<div class="gmail_msg"> Eine Frage
zu der Grafik: </div>
<div class="gmail_msg"> Was genau
stimmt da aus deiner Sicht nun
nicht? </div>
<div class="gmail_msg"> <br
class="gmail_msg">
</div>
<div class="gmail_msg"> <br
class="gmail_msg">
</div>
<div class="gmail_msg"> Grüße<br
class="gmail_msg">
<div class="gmail_msg"> <br
class="gmail_msg">
</div>
<div class="gmail_msg"> <img
moz-do-not-send="true"
alt="pasted1"
src="http://Attachment/Y2lkOjE1NzBkZDI0N2QzZDBjYWQyMjAy"
style="max-width:100.0%"
class="gmail_msg">
<div class="gmail_msg"> <br
class="gmail_msg">
</div>
<div class="gmail_quote
gmail_msg">
<blockquote
class="gmail_quote
gmail_msg" style="margin:0
0 0
0.8ex;border-left:1.0px
rgb(204,204,204)
solid;padding-left:1.0ex">
<div class="gmail_msg"> <br
class="gmail_msg">
</div>
</blockquote>
</div>
</div>
</div>
</div>
<div class="gmail_msg"> --<br
class="gmail_msg">
</div>
<div class="gmail_msg">
<p class="gmail_msg"> Von meinem
Smartphone versendet </p>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<div class="gmail_msg"> --<br class="gmail_msg">
</div>
<div class="gmail_msg">
<p class="gmail_msg"> Von meinem Smartphone
versendet </p>
</div>
</blockquote>
</div>
</blockquote>
<br class="gmail_msg">
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
<div dir="ltr">-- <br>
</div>
<div data-smartmail="gmail_signature">
<p dir="ltr">Von meinem Smartphone versendet</p>
</div>
</blockquote>
<br>
</body>
</html>