mirror of
https://github.com/bicnz/tristar-to-telegraf.git
synced 2025-05-16 08:30:09 -07:00
Update read_tsmppt.py
This commit is contained in:
parent
dc33926c0e
commit
1789f9fdb9
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Based on Morningstar documentation here
|
||||
# http://www.morningstarcorp.com/wp-content/uploads/2014/02/TSMPPT.APP_.Modbus.EN_.10.2.pdf
|
||||
@ -12,7 +12,7 @@ import sys
|
||||
import json
|
||||
|
||||
if len(sys.argv) <= 1:
|
||||
print "Usage: read_tsmppt.py <ip address> <host alias>"
|
||||
print ("Usage: read_tsmppt.py <ip address> <host alias>")
|
||||
exit(1)
|
||||
|
||||
host = sys.argv[1]
|
||||
@ -67,7 +67,7 @@ maxTb_daily = rr.registers[72]
|
||||
dipswitches = bin(rr.registers[48])[::-1][:-2].zfill(8)
|
||||
led_state = rr.registers
|
||||
data = {
|
||||
alias : {
|
||||
"SiteID" : alias,
|
||||
"battvolt" : battsV,
|
||||
"battsense" : battsSensedV,
|
||||
"battamps" : battsI,
|
||||
@ -85,7 +85,6 @@ data = {
|
||||
"batttempmin" : minTb_daily,
|
||||
"batttempmax" : maxTb_daily,
|
||||
}
|
||||
}
|
||||
json_str = json.dumps(data)
|
||||
print json_str
|
||||
print (json_str)
|
||||
client.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user