Comments (4)
In my case I wanted to change the slave address of an Epever XTRA3210N Solar Charge Controller.
With some reverse engineering of the official Epever software I found out that you cannot change the slave address to a normal register value, but you can use the function code 69 to change it.
I used the following line of code to change the address. It will probably return an error message because it cannot parse the result, but the change went through in my case.
instrument._perform_command(69, instrument._num_to_onebyte_string(newId)) (minimalmodbus v2.0.1)
from epevermodbus.
via the command line with argument --slaveaddress
`usage: epevermodbus [-h] [--portname PORTNAME] [--slaveaddress SLAVEADDRESS]
optional arguments:
-h, --help show this help message and exit
--portname PORTNAME Port name for example /dev/ttyUSB0
--slaveaddress SLAVEADDRESS
Slave address 1-247
--baudrate BAUDRATE Baudrate to communicate with controller (default is 115200)`
and within the code
controller = EpeverChargeController(args.portname, {slave address 1-275}, args.baudrate)
from epevermodbus.
Or do you mean set a new permanent slave address on the device itself?
One manual (https://www.img4.cz/i4wifi/attach/StoItem/7245/MODBUS-Protocol-v25.pdf) I found says:
2. The default controller ID number is "1", we can modify the ID via PC
common software or MT50 LCD unit (Tips: when modify ID, please make sure
the bus only connects a controller. After modifying the ID, please recharge the
controller.)
But I does not mention how it is done.
I tried to find out if the MODBUS specification states any standard way. But wasn't successful :-/
from epevermodbus.
FTR: I've tried this on my Tracer 2210 and was not successful:
d = epevermodbus.EpeverChargeController(portname="/dev/ttyUSB0", slaveaddress=1)
d.get_solar_voltage() # works
d._perform_command(69, b'\x01')
Traceback (most recent call last): (...)
minimalmodbus.InvalidResponseError: Wrong return slave address: 248 instead of 1. The response is: b'\xf8E;\x83r'
e = epevermodbus.EpeverChargeController(portname="/dev/ttyUSB0", slaveaddress=248) # trying the address from the exception
e.get_solar_voltage()
Traceback (most recent call last): (...)
minimalmodbus.InvalidResponseError: Wrong return slave address: 59 instead of 248. The response is: b';\x04\x02\x04\xb4c\x82'
f = epevermodbus.EpeverChargeController(portname="/dev/ttyUSB0", slaveaddress=59) # again, trying the address from the exception.
f.get_solar_voltage() # but works this time.
12.04
The actual ID my device assumes seems to be wildly random. But the EPEVER vendor-software is still able to discover the device and to set a new ID.
from epevermodbus.
Related Issues (17)
- syntax error on raspberry pi 4 HOT 2
- Are the retries necessary? HOT 4
- Negative temperature readings HOT 3
- Incorrect Battery Type HOT 1
- Req: Write Coils for Load On/Off Switching HOT 4
- Unsupported battery type? HOT 6
- write other parameters HOT 1
- Write battery parameters HOT 13
- Read / Set controller clock HOT 3
- feature output
- Error message after running "epevermodbus --portname /dev/ttyUSB0 --slaveaddress 1" HOT 7
- Add temperature limit readings HOT 1
- Fix command-line tool solar power call, possibly use native power readings, add battery power. HOT 9
- Add switches to command line tool (filters, load control, etc.) HOT 1
- Testing local changes HOT 3
- Automated testing / test harness HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epevermodbus.