w4tsn / node-red-contrib-modbus-api

An API like node-red implementation of the modbus-serial package.
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Write functionality #2

Open w4tsn opened 5 years ago

w4tsn commented 5 years ago

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.

gemini86 commented 5 years ago

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 5 years ago

Sure, go ahead and send it.

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

gemini86 commented 4 years ago

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!