mirror of
https://github.com/bicnz/tristar-to-telegraf.git
synced 2025-05-19 01:40: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
|
# 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,25 +67,24 @@ 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,
|
||||||
"battwatts" : (battsV*battsI),
|
"battwatts" : (battsV*battsI),
|
||||||
"arrayvolt" : arrayV,
|
"arrayvolt" : arrayV,
|
||||||
"arrayamps" : arrayI,
|
"arrayamps" : arrayI,
|
||||||
"arraywatts" : (arrayV*arrayI),
|
"arraywatts" : (arrayV*arrayI),
|
||||||
"heatsinktemp" : hsTemp,
|
"heatsinktemp" : hsTemp,
|
||||||
"batttemp" : rtsTemp,
|
"batttemp" : rtsTemp,
|
||||||
"state" : statenum,
|
"state" : statenum,
|
||||||
"powerout" : outPower,
|
"powerout" : outPower,
|
||||||
"powerin" : inPower,
|
"powerin" : inPower,
|
||||||
"battvoltmin" : minVb_daily,
|
"battvoltmin" : minVb_daily,
|
||||||
"battvoltmax" : maxVb_daily,
|
"battvoltmax" : maxVb_daily,
|
||||||
"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