nmakel / sdm_modbus

Eastron SDM Modbus data collection library
MIT License
45 stars 40 forks source link

Unable to read holding register with SDM230 meter #2

Closed jonathandreyer closed 4 years ago

jonathandreyer commented 4 years ago

Hello,

Congrats for the library. I have tried to use with a SDM230 meter and after some tests, I was unable to read holding register with an SDM230 device. On the modbus line, I have two devices (one SDM230 and one SDM120) and I can read holding register on SDM120.

I have the following error: IndexError: tuple index out of range

The traceback is: Traceback (most recent call last): File "../test-sdm230.py", line 25, in <module> meter.read_all(sdm_modbus.registerType.HOLDING) File "../nmakel-sdm_modbus/sdm_modbus/__init__.py", line 240, in read_all register_batch = {k: v for k, v in registers.items() if (v[7] == batch)} File "../nmakel-sdm_modbus/sdm_modbus/__init__.py", line 240, in <dictcomp> register_batch = {k: v for k, v in registers.items() if (v[7] == batch)} IndexError: tuple index out of range

Have you an idea how to fix that?

nmakel commented 4 years ago

The batch value for the running_time holding register was missing, causing the tuple index error. Could you grab the latest git version and try again? I would appreciate it very much if you could verify the correctness of the values you receive from your SDM230, as I don't have one to test with.

jonathandreyer commented 4 years ago

Thanks for the fix. Now, it is OK. With pleasure, I will do that soon.

jonathandreyer commented 4 years ago

It seems OK for me. There are some differences in holding registers with the datasheet that I have but I seems that there is more than one version of modbus meter.