forked from kasbert/epsolar-tracer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.py
41 lines (32 loc) · 1.04 KB
/
info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from pyepsolartracer.client import EPsolarTracerClient
from pyepsolartracer.registers import registers,coils
from test.testdata import ModbusMockClient as ModbusClient
# configure the client logging
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.INFO)
serialclient = ModbusClient()
#serialclient = None
client = EPsolarTracerClient(serialclient = serialclient)
client.connect()
response = client.read_device_info()
print "Manufacturer:", repr(response.information[0])
print "Model:", repr(response.information[1])
print "Version:", repr(response.information[2])
response = client.read_input("Charging equipment rated input voltage")
print str(response)
for reg in registers:
#print
#print reg
value = client.read_input(reg.name)
print value
#if value.value is not None:
# print client.write_output(reg.name,value.value)
for reg in coils:
#print
#print reg
value = client.read_input(reg.name)
print value
#print client.write_output(reg.name,value.value)
client.close()