From: Chrisu Jähnl Date: Sat, 27 May 2017 20:50:22 +0000 (+0200) Subject: 1. Proof of concept X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/commitdiff_plain/a28a947087560f34ef4722333f7c0c64bdeac00e 1. Proof of concept --- a28a947087560f34ef4722333f7c0c64bdeac00e diff --git a/seewasser.py b/seewasser.py new file mode 100755 index 0000000..1697206 --- /dev/null +++ b/seewasser.py @@ -0,0 +1,31 @@ +#! /usr/bin/python3 + +import datetime + + +jetzt = datetime.datetime.now() + +# print(jetzt) + +# einen Sensor auslesen +#/sys/bus/w1/devices/ +sensorfile = "/sys/bus/w1/devices/28-0316a21383ff/w1_slave" + +file = open(sensorfile) + +content = file.read() + +file.close() + +# Inhalt des Sensors: +# 64 01 4b 46 7f ff 0c 10 01 : crc=01 YES +# 64 01 4b 46 7f ff 0c 10 01 t=22250 + +temp = content[-6:-1] +temp = float(temp)/1000 + + +print(temp) + +# Nur für die Ausgabe wird gerundet +print('Die Seetemperatur ist {:.1f}°C'.format(temp)) \ No newline at end of file