mirror of
https://github.com/bicnz/tristar-to-telegraf.git
synced 2025-05-18 09:20:08 -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
|
# Based on Morningstar documentation here
|
||||||
# http://www.morningstarcorp.com/wp-content/uploads/2014/02/TSMPPT.APP_.Modbus.EN_.10.2.pdf
|
# http://www.morningstarcorp.com/wp-content/uploads/2014/02/TSMPPT.APP_.Modbus.EN_.10.2.pdf
|
||||||
@ -12,7 +12,7 @@ import sys
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
if len(sys.argv) <= 1:
|
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)
|
exit(1)
|
||||||
|
|
||||||
host = sys.argv[1]
|
host = sys.argv[1]
|
||||||
@ -67,7 +67,7 @@ maxTb_daily = rr.registers[72]
|
|||||||
dipswitches = bin(rr.registers[48])[::-1][:-2].zfill(8)
|
dipswitches = bin(rr.registers[48])[::-1][:-2].zfill(8)
|
||||||
led_state = rr.registers
|
led_state = rr.registers
|
||||||
data = {
|
data = {
|
||||||
alias : {
|
"SiteID" : alias,
|
||||||
"battvolt" : battsV,
|
"battvolt" : battsV,
|
||||||
"battsense" : battsSensedV,
|
"battsense" : battsSensedV,
|
||||||
"battamps" : battsI,
|
"battamps" : battsI,
|
||||||
@ -85,7 +85,6 @@ data = {
|
|||||||
"batttempmin" : minTb_daily,
|
"batttempmin" : minTb_daily,
|
||||||
"batttempmax" : maxTb_daily,
|
"batttempmax" : maxTb_daily,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
json_str = json.dumps(data)
|
json_str = json.dumps(data)
|
||||||
print json_str
|
print (json_str)
|
||||||
client.close()
|
client.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user