signalk-ships-bells
v0.1.4
Published
SignalK Server plugin that plays traditional ship's bell audio on the half-hour watch schedule
Maintainers
Readme
signalk-ships-bells
A SignalK Server plugin that plays traditional ship's bell audio on the watch schedule (one strike every half hour, up to eight bells).
Status
Watch-bell scheduling and playback are both implemented: index.js computes
the strike schedule and emits a notification delta; the public/ webapp
listens for it over the SignalK websocket and plays the matching audio file.
Features
- Strikes the bell every half hour, 1–8 bells, following the traditional watch
schedule - plus one extra 8-bell strike at 23:59:47 on New Year's Eve
(31 Dec, ship-local time), 13 seconds before midnight.
bell-strikes-8.wavis ~12.78s long, so it finishes right around the stroke of midnight, just ahead of the regular 00:00:00 strike (which always rings 8 bells anyway, on every schedule) - giving the traditional 16 bells for New Year's without needing a dedicated audio file or any change to the normal schedule. Configurable in the SignalK admin UI (Server → Plugin Config → Ship's Bell):- Enable bell strikes — on/off.
- Watch bell schedule — two selectable conventions for the second dog
watch (18:00–20:00), the one place historical practice diverges:
- British Navy — resets to 1 bell at 18:30 instead of continuing 5-6-7, per the post-1797 Royal Navy convention adopted after the Nore mutiny (five bells in the second dog watch had been the mutiny's signal).
- Standard — ignores the dog-watch split as a concept and just cycles 1–8 every 4 hours all day, including through the second dog watch (18:30=5, 19:00=6, 19:30=7, 20:00=8).
- Mute bell when at anchor or moored — skips playback while
navigation.stateisanchoredormoored. Requires that path to be populated by something on your system — see below. - Mute during a time range — an optional overnight/quiet-hours mute,
with a start and end time (
HH:MM, 24-hour, ship-local time). The end time can be earlier than the start to span midnight, e.g.22:00–06:00. Independent of, and combinable with, the anchor/moored mute above. - Playback method —
webapp,server speaker, orboth:- Webapp — each strike is sent as a
notifications.plugins.signalkShipsBell.strikedelta. The bundled webapp (open it from the SignalK admin UI's webapps list, or at/signalk-ships-bells/) subscribes to that delta over the websocket and plays the matching file via<audio>— so it sounds wherever that page is open (e.g. a browser tab on an MFD or tablet at the helm). A "play test bell" button is included for checking that audio works without waiting for the next half hour - it plays locally in the browser immediately, and also asks the plugin to attempt server-speaker playback if that's part of the configured playback method, so it exercises whichever output(s) are actually configured. - Server speaker — plays directly on the machine running Signal K, via a
speaker wired to it, using play-sound
to shell out to a system audio player. No browser needed. This is the
same underlying approach as
signalk-audio-notifications,
which plays spoken alerts the same way. Requires a system player such as
mpg123oraplayto be installed on that machine —play-soundpicks whichever it finds. If none is found, an error is logged and playback is silently skipped rather than crashing the plugin. - Both — does both of the above.
- Webapp — each strike is sent as a
- Schedule selection from the webapp — the same watch-bell schedule choice
is also available directly in
public/, via a dropdown that reads and writes the setting through a small REST API exposed by the plugin (GET/PUT /plugins/signalk-ships-bells/schedule), so it can be changed without going into Server → Plugin Config.
Recommended companion plugins
- signalk-autostate —
automatically sets
navigation.state(e.g.anchored,moored,sailing,motoring) from GPS and propulsion data. The "mute at anchor or moored" option here depends onnavigation.statebeing set by something; if you don't already have a source for it, this plugin is a good fit.
Audio assets
public/bells/ bundles one WAV file per strike count, bell-strikes-1.wav through
bell-strikes-8.wav, served statically by SignalK server's signalk-webapp hosting
at /signalk-ships-bells/bells/. These are sourced from Benboncan's "Bells / Gongs"
pack on Freesound (CC BY 4.0) — see public/bells/NOTICE.md for full attribution.
Install
Available on npm as signalk-ships-bells —
install it from the SignalK Server admin UI's App Store, or via:
npm install signalk-ships-bellsFor local development, clone into your SignalK server's node_modules, or use npm link.
Development
Run the test suite with:
npm testThis runs Node's built-in test runner (node --test) over test/*.test.js, which
covers the bell-schedule math for all three watch schemes, the plugin's config
schema, its start/stop/restart lifecycle, and the /schedule REST endpoint.
CI runs on every push and pull request via the reusable
SignalK plugin-ci workflow
(.github/workflows/ci.yml), which additionally validates the plugin's
package.json, entry point, schema, and lifecycle across Linux, macOS,
Windows, and Raspberry Pi-class Node versions.
License
Source code: MIT. Bundled bell audio (public/bells/): CC BY 4.0, attributed to
Benboncan on Freesound. See LICENSE for the full text of both.
