node-red-contrib-bg-hercules 0.2.0
Node-RED nodes for B&G Hercules / H5000 GoFree websocket
node-red-contrib-bg-hercules
Node-RED nodes for B&G Hercules (and H5000 / Triton Edge) processors over Navico GoFree websocket, default port 2053.
Not affiliated with or endorsed by Navico or B&G.
All flow nodes share one websocket per CPU config node, with keepalive, connect timeout, write queue, and automatic reconnect.
Script bridge is the only WTP-specific node and lives in the Hercules WTP palette. Everything else is under Hercules.
Install
cd ~/.node-red
npm install TTCMarine/node-red-contrib-bg-hercules
Restart Node-RED.
CPU config
Create a hercules-cpu config: hostname or IP, port 2053, optional name, and keepalive (pong default, or ping if your processor expects that).
One config holds one connection. Child nodes multiplex over that socket.
On connect the CPU requests the live data dictionary (DataListReq / DataInfoReq), NMEA 2000 device list (DeviceListReq with DeviceTypes: []), and setting groups (SettingListReq / SettingInfoReq). If the processor is offline, the editor falls back to a built-in dictionary.
Nodes
Data subscribe (hercules-data-sub) — Hercules
Subscribes to one channel.
msg.topicis the short name (e.g.BSP), long name, or numeric idmsg.payloadis the GoFree data item pluslong_name,short_name,unit, andvaluepayload.valuecopies the chosen field (valby default, ordampedVal/sysVal).payload.unitmatchesval, not necessarilysysVal- Optional output rate: only send when the value changes, and/or at most every N ms
- Optional Source (
n2kName) subscribes to one NMEA 2000 producer (labelled fromDeviceListmodel names); optional Max rate sets GoFreemaxRateonDataReq - Unsubscribe uses
UnsubscribeData
Search the channel list by name or id. If a channel is missing, enter its numeric id. With no node name, the canvas label is the short name (or subscribe plus the id).
Remote channel (hercules-remote-channel) — Hercules
Writes a numeric msg.payload to a Remote or Linear channel. On connect it sets captions.
Start line (hercules-start-line) — Hercules
Choose Ping port or Ping starboard on the node. Any input (or the canvas button) fires it.
From msg still accepts a string ("port"), { "ping": "port" }, or msg.topic.
Race timer (hercules-race-timer) — Hercules
Choose Start, Stop, Sync, or Reset on the node. Any input (or the canvas button) fires it.
From msg still accepts a string ("start"), { "timer": "start" }, or msg.topic.
Setting (hercules-setting) — Hercules
Read or write a CPU setting, or a per-sensor setting on an NMEA 2000 device.
- Source empty = CPU (
SettingListReqby group,SettingInfoReq,SettingReqwithregister: true) - Source = an NMEA 2000 device from
DeviceList(Manufacturer+ModelId, stored asNDP2kName) wraps the same messages inDeviceMessageafterDeviceSubscribe - Empty payload or
{ "get": true }reads - A value or
{ "value": ... }writes (objects/arrays pass through for tables and enums) - Output:
{ "id", "name", "value", "type", "readOnly", "n2kName?", "setting" }
Event (hercules-event) — Hercules
Register for a GoFree event (EventReg) and emit each EventSet item.
- Known ids:
21CAN Diagnostics,44Heartbeat - Any input sends
{ "EventSet": [{ "id": N, "action": "request" }] }(needed for CAN diagnostics)
Script bridge (wtp-script-bridge) — Hercules WTP
WTP only. Pick a channel (same dictionary as subscribe) and a bridge number. msg.payload is the number to write:
6.2
null or { "value": 6.2, "valid": false } marks the channel invalid. Channel from msg still accepts { "id": 42, "value": 6.2, "valid": true }.
Writes while disconnected
Data, Setting, EventSet, and DeviceMessage (when the inner payload is a write) are queued (up to 32) and flushed when the socket reopens. Subscriptions, setting registrations, and event registrations are re-sent on every connect.
Examples
Import Hercules data subscribe, Hercules race start, Hercules setup, Hercules remote channel, and Hercules WTP script bridge from the node's examples menu, then set the CPU host.
Tests
npm test
The suite starts a mock GoFree websocket server (no Hercules required).
Protocol notes
The mock in test/helpers/gofree-mock.js follows the Hercules captures (DeviceListReq with DeviceTypes: [], SettingListReq by groupId, SettingInfo, SettingReq.register, UnsubscribeData, DeviceMessage). Adjust from a websocket capture if firmware differs.