Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add read_input and write_output methods
- Loading branch information
Showing
5 changed files
with
248 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
# epsolar-tracer | ||
Tools for EPsolar Tracer solar charge controller | ||
================================================ | ||
[Product link](http://www.epsolarpv.com/en/index.php/Product/pro_content/id/573/am_id/136) | ||
|
||
Linux driver for Exar USB UART | ||
xr_usb_serial_common-1a | ||
https://www.exar.com/common/content/default.aspx?id=10296 | ||
------------------------------ | ||
xr_usb_serial_common-1a | ||
[Original source](https://www.exar.com/common/content/default.aspx?id=10296) | ||
|
||
apt-get install dkms | ||
|
||
Protocol | ||
-------- | ||
[Protocol](http://www.solar-elektro.cz/data/dokumenty/1733_modbus_protocol.pdf) | ||
|
||
Python module | ||
------------- | ||
Uses modbus library (https://github.com/bashwork/pymodbus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,40 @@ | ||
|
||
from pyepsolartracer.tracer import EPsolarTracerClient | ||
|
||
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 reg | ||
value = client.read_input(reg[0]) | ||
print value | ||
#print client.write_output(reg[0],value.value) | ||
|
||
for reg in coils: | ||
#print reg | ||
value = client.read_input(reg[0]) | ||
print value | ||
#print client.write_output(reg[0],value.value) | ||
|
||
client.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.