w4tsn/node-red-contrib-modbus-api

Write functionality

Opened this issue · 3 comments

w4tsn commented

This is a basic one not yet implemented because of time constraints. Of course it would be nice if the API-Node could also write/send messages to a server.

Currently as a workaround I recommend using the node-red-contrib-modbus package for write-operations.

I've taken a shot at adding the functions setRegister and setCoil. There's still the issue I have of not figuring out how to send a Modbus Exception Code if the client tries to write to unhandled registers. but for the most part I have this fully functioning. Could I send you a PR?

w4tsn commented

Sure, go ahead and send it.

I'll have a look at the Exception Code part, maybe I find something.

I've updated the branch in my pull request with added modbus exception codes to handle this issue. Testing shows normal modus error responses when trying to access registers/command combinations that aren't configured with an input node. Even when trying to access them in multi-read/write functions. Hope this is helpful!