rosswarren / epevermodbus Goto Github PK
View Code? Open in Web Editor NEWPython library for communicating with EPever solar charge controllers
License: MIT License
Python library for communicating with EPever solar charge controllers
License: MIT License
A load switch would be a great addition to this project.
As the API might be starting to show all the information the API has to offer, I suggest we default to showing everything but could limit to certain sections by using switches.
I'm familiar with argparse and would like to implement this.
examples might include
--realtimedata, --batteryparameters or --load off
This would allow users without python knowledge to start using the API directly on the CLI.
It would also allow the command line tool to become the "demo" for your API.
If any temperature (e.g. batterie temp.) drops below 0.0ยฐC it is shown as 654.xx.
Can you support a json output? It is possible a PR #24 ?
Hello,
is there a way to change the slave address with this tool?
It would be nice to have some automated tests, so that the library can be quickly regression tested against a fake modbus interface when changes are made. This would reduce the time to develop new features as the library gets more complex.
Everything installed: pip install epevermodbus
Python 3.7.3
Running gives:
epevermodbus -h
Traceback (most recent call last):
File "/usr/local/bin/epevermodbus", line 6, in
from epevermodbus.command_line import main
File "/usr/local/lib/python2.7/dist-packages/epevermodbus/command_line.py", line 18
print(f"Solar voltage: {controller.get_solar_voltage()}V")
^
SyntaxError: invalid syntax
On raspberry Phyton 2 and 3 are installed. How do I install epevermodbus on python3?
Hey, really enjoyed finding your project in amongst a few others, (from a bit too scriptey, to a bit too objectey.)
I really enjoy the abstraction you've done and the command line utility really shows off how your implementation is straight forward.
In the readme, it's stated "Write battery parameters this feature is a work in progress".
I have a Tracer 2206AN and have already written my values for a 12V 100Ah battery. It seems I chose values close to those in your example.
I've raised this issue to cover adding that functionality. Would you mind if I added that functionality and created a PR for you?
There are four documented temperature readings starting at 0x9017, Read/Write functions 0x03/0x10:
"Batt Hi temp limit"
"Batt Lo temp limit"
"Device over temp"
"Device recovery temp"
source https://www.img4.cz/i4wifi/attach/StoItem/7069/MODBUS-Protocol-v25.pdf page 16
I haven't tried, but I have a suspicion they need to be written as a block like the battery voltages.
I will experiment...
In file driver.py, line 272 should be:
self.retriable_read_register(0x9000, 0, 3)
instead of
self.retriable_read_register(0x9000, 2, 3)
regards
Pavel
print(f"Solar power: {controller.get_solar_power()}W")
This issue is for points 1 to 3
I've implemented functions to read/set the clock of the charge controller to get valid results for the daily/weekly statistics.
def get_clock(self):
def split_short(val):
hext = '{0:04x}'.format(val)
ha = hext[:-2]
hb = hext[-2:]
return (int(ha,16), int(hb,16))
r = self.retriable_read_registers(0x9013,3,3)
min, sec = split_short(r[0])
day, hour = split_short(r[1])
year, mon = split_short(r[2])
year += 2000
curDate = datetime(year,mon,day,hour,min,sec)
return curDate
def set_clock(self, time):
def gen_hex(a, b):
ha = '{0:02x}'.format(a)
hb = '{0:02x}'.format(b)
return ha + hb
r3 = int(gen_hex(time.year-2000,time.month), 16)
r2 = int(gen_hex(time.day,time.hour), 16)
r1 = int(gen_hex(time.minute,time.second), 16)
self.write_registers(0x9013,[r1, r2, r3])
Can you please include these 2 functions.
I did not create a pull request since I'm not sure if this meets your requirements for clean code.
There should be a way to test local changes without having to publish to PyPI or making temporary changes to the code.
Currently, the import defaults to the installed version of the library.
First, thank you very much for creating and maintaining this tool; it's brilliant!
I get the following error on the latest release of epevermodbus
:
Traceback (most recent call last):
File "/home/alexandro/.local/bin/epevermodbus", line 8, in <module>
sys.exit(main())
File "/home/alexandro/.local/lib/python3.9/site-packages/epevermodbus/command_line.py", line 60, in main
print(f"Battery type: {controller.get_battery_type()}")
File "/home/alexandro/.local/lib/python3.9/site-packages/epevermodbus/driver.py", line 271, in get_battery_type
return {0: "USER_DEFINED", 1: "SEALED", 2: "GEL", 3: "FLOODED"}[
KeyError: 4
My controller should be set to LiFePO4. The manual shows more types than just sealed/gel/flooded/user:
https://www.epever.com/wp-content/uploads/2021/05/Tracer-AN50-100A-Manual-EN-V3.1.pdf
However, it's not clear to me how you figure out which numerical values correspond to which types. Is it trial and error?
Hi
I like to not only read the temperature_compensation_coefficient I want to write it as well.
Is it possible?
Regards
Christer
I added automatic retries because I get intermittent failures when communicating with my charge controller via my Raspberry PI Zero. I am not sure if these failures are expected or if it is a specific issue with my setup.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.