Benötigt werden ein Raspberry und ein paar billige Teile aus dem Elektronikmarkt; verbaut nach dieser Anleitung:
http://www.s-jordan.de/index.php?page=e ... aspberrypi
Damit konnte ich mit diesem Python-Skript:
Code: Alles auswählen
import serial
port = serial.Serial("/dev/ttyAMA0", baudrate = 9600, timeout = 5)
data = port.read(10000)
f = open("/home/pi/log.txt","w")
f.write(data)
f.close()Code: Alles auswählen
/ESY5Q3DA1024 V3.021-
0:0.0.0*255(54920)
1-0:1.8.0*255(00003985.3838842*kWh)
1-0:2.8.0*255(0000284.9368242*kWh)
1-0:21.7.255*255(000176.85*W)
1-0:41.7.255*255(001025.66*W)
1-0:61.7.255*255(002529.68*W)
1-0:1.7.255*255(02292.19*W)
1-0:96.5.5*255(82)
0-0:96.1.255*255(1ESY0943000XXX)!
/ESY5Q3DA1024 V3.021-
0:0.0.0*255(54920)
1-0:1.8.0*255(00003984.9838842*kWh)
1-0:2.8.0*255(0000284.9368242*kWh)
1-0:21.7.255*255(000176.85*W)
1-0:41.7.255*255(001025.66*W)
1-0:61.7.255*255(002529.68*W)
1-0:1.7.255*255(02292.19*W)
1-0:96.5.5*255(82)
0-0:96.1.255*255(1ESY0943000XXX)!Code: Alles auswählen
def extract_between(text, sub1, sub2, nth=1):
if sub2 not in text.split(sub1, nth)[-1]:
return None
return text.split(sub1, nth)[-1].split(sub2, nth)[0]
f = open("/home/pi/log.txt")
text = f.read().rstrip('\r\n')
v2 = (repr(extract_between(text, '1-0:1.8.0*255(', '*kWh)')).strip('"\''))
e2 = (repr(extract_between(text, '1-0:2.8.0*255(', '*kWh)')).strip('"\''))
a1 = (repr(extract_between(text, '1-0:1.7.255*255(', '*W)')).strip('"\''))
v1 = (repr(extract_between(text, '1-0:1.8.0*255(', '*kWh)', nth=2)).strip('"\''))
e1 = (repr(extract_between(text, '1-0:2.8.0*255(', '*kWh)', nth=2)).strip('"\''))
v11 = float(v1)
v22 = float(v2)
Bezug = int((v22-v11)*900)
e11 = float(e1)
e22 = float(e2)
Einspeisung = int((e22-e11)*900)
WattAktuell =int(float(a1))
Erzeugung = (WattAktuell-Bezug)+Einspeisung
print Bezug
print Einspeisung
print WattAktuell
print ErzeugungGruß
Unlight