@mplattu/signalk-modbus-serial-client
v1.0.1
Published
A plugin for SignalK to read data via Modbus serial
Downloads
12
Readme
signalk-modbus-serial-client
This is a SignalK server plugin for reading Modbus serial data. It owns a lot to (well, it is almost a verbatim copy of) signalk-modbus-plugin which implements similar interface for Modbus TCP devices.
For obvious reasons I am using the concepts "server" (the device which produces the data) and "client" (the device which reads the data) instead of the traditional slave/master terms.
Configuration
The plugin creates a configuration editor to Server > Plugin config. The configuration
file is stored to server's plugin-config-data/signalk-modbus-serial-client.json
.
In case you edit the file don't forget to restart the SignalK server.
Sample Configuration
The sample configuration works with
- Sunbeam MoonRay MPPT 320 solar charger (tested)
- EPSolar/EPEver Tracer A/B-Series (reference)
- Copy the attached
signalk-modbus-serial-client-SOLAR.json
asplugin-config-data/signalk-modbus-serial-client.json
. Theplugin-config-data
exists in your SignalK data directory. - Edit the
devicePath
value. The default value works with the tested USB-RS485 converter. - Restart the SignalK Server.
- Go to Data Browser on SignalK Server UI and give
electrical.solar.flybridge
as search filter. You should see values generated by the plugin. - If you want to add metadata to the data you'll have to edit the server metadata. The SignalK Server FAQ explains how to find the metadata file.
- Metadata sample:
{ "context": "vessels.self", "updates": [ { "meta": [ { "path": "electrical.solar.flybridge.batteryRemaining", "value": { "displayName": "Solar Battery Remaining", "longName": "Solar Battery Remaining", "shortName": "Solar Batt Remaining", "units": "%" } }, { "path": "electrical.solar.flybridge.batteryVoltage", "value": { "displayName": "Solar Battery Voltage", "longName": "Solar Battery Voltage", "shortName": "Solar Batt Voltage", "units": "V" } }, { "path": "electrical.solar.flybridge.chargePower", "value": { "displayName": "Solar Charge Power", "longName": "Solar Charge Power", "shortName": "Solar Chg Pwr", "units": "W" } }, { "path": "electrical.solar.flybridge.panelPower", "value": { "displayName": "Solar Panel Power", "longName": "Solar Panel Power", "shortName": "Solar Panel Pwr", "units": "W" } } ] } ] }
Troubleshooting
- Check SignalK Server Dashboard. The Connection & Plugin Status should have the
signalk-modbus-serial-client
entry. If you don't have one, the plugin is not enabled. - Check the Status column. In normal operation it says "Running" while in other cases you should see a helpful error message.
- Check Server > Server Log for other messages.
Development
Installing SignalK Server
The installation process is described in the SignalK documentation. You can either make Modbus (mock) device interface available for Docker image or install the SignalK server from git:
git clone https://github.com/SignalK/signalk-server.git
cd signalk-server
npm install
npm run build:all
bin/signalk-server
Cloning the Plugin
To install the plugin into SignalK for development first clone the repository and link the npm module:
$ git clone
$ cd signalk-modbus-serial-client
$ npm link
Then go to the SignalK configuration directory (probably ~/.signalk
) and link the module again:
$ cd .signalk
$ npm link @mplattu/signalk-modbus-serial-client
The plugin should now be installed and visible when the server has restarted.
Tests
The test automation uses Mocha, virtual serial interface and Modbus mock server
(modbus-mock-server/
). Executing make test
should do everything automatically.
Publishing to npmjs
- Make a branch
- Invent a new semantic version number
- Update
version
field in thepackage.json
- Create a changelog entry below
- Push your changes to the branch
- Make sure the tests (
publish-to-npmhs.yaml
) are ok - Merge the branch to the main branch and make sure the
publish-to-npmjs.yaml
runs without errors
Changelog
1.0.1
(8-JUL-2022) Make plugin more robust by not stopping it in case Modbus connection fails on user errors, e.g. timeout.1.0.0
(2-JUL-2022) Official release after successful field testing. Added instructions of adding metadata.0.1.0
(4-APR-2022) First public version for beta testing.