mrhyde hat geschrieben: ↑
Ich habe es nun mal geschafft, das System auf meiner Pi4 B von Grund auf zu installieren und ein Image herzustellen.
Ja, ich werde auch noch die Weiterleitung an Grainfather mit auf GITHUB mit hochladen. Das muss ich aber noch einmal testen.
Hallo MrHyde,
nach dem Kauf einer neuen microSDHC Karte habe ich das neue Image (rev2) und die Weiterleitung an „Grainfather Connect“ getestet. Als erstes habe ich die „Samba“ Unterstützung installiert und konfiguriert.
Die Debug Informationen der Weiterleitung an GRAINCONNECT von iSpindle.py laut aktuellem Repo:
Code: Alles auswählen
...connected from: ('192.168.1.3', 49656)
waiting for connection... listening on port: 9501
/usr/local/bin/iSpindle.py:281: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
timestart = time.clock()
('192.168.1.3', 49656) received:'{'
('192.168.1.3', 49656) Input Str is now:{
('192.168.1.3', 49656) received:'"name":"iSpindel-2","ID":8298158,"angle":41.35387,"temperature":10.75,"temp_units":"C","battery":3.980537,"gravity":7.66524,"interval":900,"RSSI":-66}\r\n'
('192.168.1.3', 49656) Input Str is now:{"name":"iSpindel-2","ID":8298158,"angle":41.35387,"temperature":10.75,"temp_units":"C","battery":3.980537,"gravity":7.66524,"interval":900,"RSSI":-66}
detected iSpindel
('192.168.1.3', 49656) Sent ACK.
/usr/local/bin/iSpindle.py:368: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
dbgprint(repr(addr) + ' Time elapsed: ' + str(time.clock() - timestart))
('192.168.1.3', 49656) Time elapsed: 0.004756000000000038
('192.168.1.3', 49656) iSpindel-2 (ID:8298158) : Data Transfer OK.
('192.168.1.3', 49656) - closed connection
('192.168.1.3', 49656) Reading last recipe name for corresponding Spindel iSpindel-2
('192.168.1.3', 49656) Recipe Name not found - Database Error: 'NoneType' object is not subscriptable
('192.168.1.3', 49656) Reading last recipe_id value for corresponding Spindel iSpindel-2
Recipe_ID: Done. None
('192.168.1.3', 49656) - writing to database
('192.168.1.3', 49656) - DB data written.
/usr/local/bin/sendmail.py:58: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
config.readfp(f)
('192.168.1.3', 49656) - forwarding to Grainfather Connect at http://community.grainfather.com:80/iot/aaaa-bbbb/ispindel
('192.168.1.3', 49656) - sending: {"name":"iSpindel-2","ID":8298158,"angle":41.35387,"temperature":10.75,"temp_units":"C","battery":3.980537,"gravity":7.66524,"interval":900,"RSSI":-66}
('192.168.1.3', 49656) to : http://community.grainfather.com:80/iot/aaaa-bbbb/ispindel
<class 'ValueError'> sendmail.py 600
Um das Debug ohne Warnungen etwas übersichtlicher zu machen, habe ich folgende Anpassungen durchgeführt:
/usr/local/bin/iSpindle.py in Zeile 281 und 368 „time.clock“ geändert auf „time.monotonic“
/usr/local/bin/sendmail.py in Zeile 58 „config.readfp“ geändert auf „config.read_file“
Den Phyton Code iSpindle.py für die Weiterleitung an “Grainfather Connect“ (GRAINCONNECT) habe ich angepasst und um die Debug-Information für den HTTP Status Code (response) erweitert:
Code: Alles auswählen
if GRAINCONNECT and gauge == 0:
try:
import urllib3
dbgprint(repr(addr) + ' - forwarding to Grainfather Connect at http://community.grainfather.com:80' + GC_URL)
out = inpstr
dbgprint(repr(addr) + ' - sending: ' + out)
url = 'http://community.grainfather.com:80' + GC_URL
dbgprint(repr(addr) + ' to : ' + url)
http = urllib3.PoolManager()
response = http.request('POST', url, body=out, headers={'Content-Type': 'application/json'})
dbgprint(repr(addr) + ' - HTTP status code received: ' + str(response.status))
except Exception as e:
dbgprint(repr(addr) + ' - forwarding to Grainfather Connect Error: ' + str(e))
Die Debug Informationen der Weiterleitung an GRAINCONNECT nach den Änderungen:
Code: Alles auswählen
waiting for connection... listening on port: 9501
...connected from: ('192.168.1.6', 63766)
waiting for connection... listening on port: 9501
('192.168.1.6', 63766) received:'{'
('192.168.1.6', 63766) Input Str is now:{
('192.168.1.6', 63766) received:'"name":"iSpindel-1","ID":8299101,"angle":33.94013,"temperature":10.75,"temp_units":"C","battery":4.120228,"gravity":5.767748,"interval":900,"RSSI":-76}\r\n'
('192.168.1.6', 63766) Input Str is now:{"name":"iSpindel-1","ID":8299101,"angle":33.94013,"temperature":10.75,"temp_units":"C","battery":4.120228,"gravity":5.767748,"interval":900,"RSSI":-76}
detected iSpindel
('192.168.1.6', 63766) Sent ACK.
('192.168.1.6', 63766) Time elapsed: 0.013087565999740036
('192.168.1.6', 63766) iSpindel-1 (ID:8299101) : Data Transfer OK.
('192.168.1.6', 63766) - closed connection
('192.168.1.6', 63766) Reading last recipe name for corresponding Spindel iSpindel-1
('192.168.1.6', 63766) Recipe Name not found - Database Error: 'NoneType' object is not subscriptable
('192.168.1.6', 63766) Reading last recipe_id value for corresponding Spindel iSpindel-1
Recipe_ID: Done. None
('192.168.1.6', 63766) - writing to database
('192.168.1.6', 63766) - DB data written.
('192.168.1.6', 63766) - forwarding to Grainfather Connect at http://community.grainfather.com:80/iot/aaaa-bbbb/ispindel
('192.168.1.6', 63766) - sending: {"name":"iSpindel-1","ID":8299101,"angle":33.94013,"temperature":10.75,"temp_units":"C","battery":4.120228,"gravity":5.767748,"interval":900,"RSSI":-76}
('192.168.1.6', 63766) to : http://community.grainfather.com:80/iot/aaaa-bbbb/ispindel
<class 'ValueError'> sendmail.py 600
('192.168.1.6', 63766) - HTTP status code received: 201
Die Weiterleitung an "Grainfather Connect" und die "HTTP status code" Antwort funktioniert.
Da ich am RasPI ein 7“ Touchscreen installiert habe, muss ich erst schauen, ob ich das neue Image um die graphische Darstellung erweitere, oder dass „Tozzi“ Image (wo aktuell Daten für die Kalibrierung der iSpindel gesammelt werden) mit dem aktuellen Repo aktualisiere.
Gruß
Christian