Code Monkey home page Code Monkey logo

Comments (4)

Janl1 avatar Janl1 commented on July 3, 2024 1

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.

asscherhofstede avatar asscherhofstede commented on July 3, 2024

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.

SmithChart avatar SmithChart commented on July 3, 2024

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.

SmithChart avatar SmithChart commented on July 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.