Skip to content

Modbus exception 2 with d.scan() on Model ID 714 SMA Sunny Tripower X 20 #89

@Friedemannn

Description

@Friedemannn

Hi,
I'm trying to read out a SMA Tripower X Inverter.
During daytime I can read up to and including Model 712, but on Model 714 I'm getting following error:

ModbusClientException: Modbus exception 2: addr: 41161 count: 95

Code up to this point is:
import sunspec2.modbus.client as client
d = client.SunSpecModbusClientDeviceTCP(slave_id=126,ipaddr='172.23.58.22', ipport=502,trace_func=print)
d.scan()

According to the model_714.json and the PICS file supplied by SMA this adress corresponds to the Model ID and should be of size 1.

grafik
41161

As far as I understand pysunspec2 should do d.read(41161,1) and not d.read(41161,95). (Count corresponds to size/length?)

If I do .read() manually I'm getting the following results:
grafik
With d.read(41161,3) its the exception again: ModbusClientException: Modbus exception 2: addr: 41161 count: 3
If I do d.read(41162,1) its b'\x00]' which corresonds to [0,93].

This probably has something to do with Issue #36, but I don't fully understand whats happening. I've also run @bijwaard's sma-test.py and got this result:

41161: ID=234
41162: L=93
traceback ...
Modbus exception 2: addr: 41256 count: 1

Just to check if I understand whats happening:
With d.read(41161,1) I'm reading the first byte of 41161 which should be something like [0,714] but the Inverter responds with something wrong which trips up d.scan()? Edit: [2,202] is correct, it equal 2*256+202=714
With d.read(41161,2) I'm reading the first two bytes of 41161, which is 41161 and 41162? Edit: That is whats happening.
With d.read(41161,3) I'm trying to read 41163 which doesn't exist/isn't implemented. Because of that I'm getting the exception.
@bijwaard's sma-test.py somehow adds an offset with which one can somehow successfully read the whole model? Why is that?

To conclude, is this a problem with pysunspec2 or should I contact SMA? (Or with my implementation?)

(When I played around with it yesterday d.scan() didn't work during daytime but did work during nighttime. Without sun I've gotten the following result for 714:

{"ID": 714, "L": 18, "PrtAlrms": null, "NPrt": 0, "DCA": null, "DCW": null, "DCWhInj": null, "DCWhAbs": null, "DCA_SF": -1, "DCV_SF": 0, "DCW_SF": 1, "DCWH_SF": 0, "Tmp_SF": null}]}

But L should be 93? Anyhow, today I was not able to replicate it, the exception still pops up even without sun. Maybe because it has nothing to do with it?) Edit: Is replicable, see below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions