tiagocoutinho / modbus-proxy

Connect multiple clients to modbus devices
Other
71 stars 13 forks source link

Support remapping unit IDs for wonky clients and servers #26

Closed Gert-dev closed 5 months ago

Gert-dev commented 1 year ago

Some clients require a minimum unit ID of 1 (e.g. Loxone home automation's MODBUS server support), and some servers have a device on unit ID 0 (e.g. Huawei SUN-2000L), making both incompatible. Ideally they should support one another, but when wonky implementations such as these don't, with this PR you can let the proxy remap one unit ID to another to fix this.

Marking this as draft since I've already tested this working with qModMaster, but still need to test on-device to ensure it actually fixes my problem :wink: .

Fixes #25.

tiagocoutinho commented 1 year ago

shouldn't you apply the inverse unit map transformation in the reply?

Gert-dev commented 1 year ago

shouldn't you apply the inverse unit map transformation in the reply?

Yes, probably :slightly_smiling_face: . I had already placed a comment for myself that mentions that, but it's stuck pending for some reason:

afbeelding

I'll try to get to that in the next couple of days.

tiagocoutinho commented 1 year ago

could you add some tests? I would feel more comfortable accepting the PR if there are some 🙏🏽

Gert-dev commented 1 year ago

shouldn't you apply the inverse unit map transformation in the reply?

Done. I verified it works with Loxone. Finally I can get my solar inverter's data into my home automation without too much hassle :tada: .

(If anyone from Loxone/Huawei is reading this, YOU'RE WELCOME - thanks for ignoring interoperability and just finger-pointing at one another when contacted for support. :unamused: )

could you add some tests? I would feel more comfortable accepting the PR if there are some 🙏🏽

I'll try. I'm familiar with writing tests, but not so much with Python nor its test frameworks :slightly_smiling_face: .

Gert-dev commented 1 year ago

I added a test.

marcelrv commented 8 months ago

thanks, this seems to work well for me. In my case the Victron requires a Id of 126, but the solar invertor is set to 1. This PR allowed the remapping