signalk-virtual-weather-sensors
v1.3.0
Published
Signal K plugin that provides comprehensive weather data from AccuWeather API with calculated wind values and NMEA2000-compatible environmental measurements
Maintainers
Readme
Signal K Virtual Weather Sensors Plugin
A Signal K plugin that fetches weather data from the AccuWeather API and emits it as NMEA2000-compatible Signal K deltas. Provides 24+ environmental data points including temperatures, wind, atmospheric conditions, and marine safety indices.
Features
- 24+ weather data points from AccuWeather: temperatures (7 types), wind (speed, gusts, direction, Beaufort), atmospheric conditions (pressure, humidity, UV, visibility, clouds), and precipitation
- Apparent wind calculation from true wind + vessel motion vectors
- NMEA2000 alignment with
signalk-nmea2000-emitter-cannonPGN conventions (130306, 130311, 130312, 130313) - Interval-based emission (default 5s) for reliable NMEA2000 network recognition
- Delta caching -- only rebuilds the Signal K delta when weather data actually changes
- Rate limit handling with Retry-After header support and linear backoff fallback
- Bounded responses -- 1 MiB cap on AccuWeather response bodies + schema validation before use
- API key sanitization in log output
Installation
From npm
npm install signalk-virtual-weather-sensorsFrom source
git clone https://github.com/NearlCrews/signalk-virtual-weather-sensors.git
cd signalk-virtual-weather-sensors
npm install
npm run buildThen symlink or copy into your Signal K server's plugin directory:
ln -s "$(pwd)" ~/.signalk/node_modules/signalk-virtual-weather-sensorsConfiguration
| Setting | Description | Default | Range | |---------|-------------|---------|-------| | AccuWeather API Key | Required. Get one free at developer.accuweather.com | -- | -- | | Update Frequency | How often to fetch new weather data (minutes) | 5 | 1--60 | | Emission Interval | How often to emit the current data to the NMEA2000 network (seconds) | 5 | 1--60 |
Signal K Paths
Core Environmental
| Path | Unit | Description |
|------|------|-------------|
| environment.outside.temperature | K | Air temperature |
| environment.outside.pressure | Pa | Atmospheric pressure |
| environment.outside.humidity | ratio (0--1) | Relative humidity (per Signal K spec) |
| environment.outside.dewPointTemperature | K | Dew point |
| environment.outside.windChillTemperature | K | Wind chill |
| environment.outside.heatIndexTemperature | K | Heat index (RealFeel) |
Enhanced Temperatures
| Path | Unit | Description |
|------|------|-------------|
| environment.outside.realFeelShade | K | RealFeel in shade |
| environment.outside.wetBulbTemperature | K | Wet bulb |
| environment.outside.wetBulbGlobeTemperature | K | Wet bulb globe (heat stress) |
| environment.outside.apparentTemperature | K | AccuWeather apparent temperature |
Wind
| Path | Unit | Description |
|------|------|-------------|
| environment.wind.speedTrue | m/s | True wind speed |
| environment.wind.directionTrue | rad | True wind direction |
| environment.wind.speedOverGround | m/s | Wind speed over ground (mirrors speedTrue) |
| environment.wind.speedApparent | m/s | Apparent wind speed (calculated) |
| environment.wind.angleApparent | rad | Apparent wind angle relative to bow (omitted when no heading is available) |
| environment.wind.speedGust | m/s | Gust speed |
| environment.wind.gustFactor | ratio | Gust / sustained ratio |
| environment.wind.beaufortScale | 0--12 | Beaufort scale |
Atmospheric & Safety
| Path | Unit | Description |
|------|------|-------------|
| environment.outside.uvIndex | index | UV radiation (0--15+) |
| environment.outside.visibility | m | Visibility distance |
| environment.outside.cloudCover | ratio (0--1) | Cloud coverage |
| environment.outside.cloudCeiling | m | Cloud base height |
| environment.outside.absoluteHumidity | kg/m3 | Calculated absolute humidity |
| environment.outside.airDensity | kg/m3 | Calculated air density |
| environment.outside.heatStressIndex | 0--4 | Heat stress level |
| environment.outside.temperatureDeparture24h | K | 24-hour temperature change |
| environment.outside.precipitationLastHour | m | Precipitation in last hour |
| environment.outside.precipitationCurrent | m/s | Current precipitation rate |
NMEA2000 Integration
This plugin outputs Signal K deltas only. To bridge them onto a physical NMEA2000 bus, pair with an emitter plugin such as signalk-nmea2000-emitter-cannon. Instance numbers and PGN priority are assigned by the emitter; this plugin does not embed them in the deltas it produces.
PGN Coverage (when paired with signalk-nmea2000-emitter-cannon)
| PGN | Description | Source paths emitted by this plugin |
|-----|-------------|-------------------------------------|
| 130306 | Wind Data | environment.wind.speedTrue, directionTrue, speedOverGround, speedApparent, angleApparent, speedGust |
| 130311 | Environmental Parameters | environment.outside.pressure |
| 130312 | Temperature | environment.outside.temperature, dewPointTemperature, windChillTemperature, heatIndexTemperature, realFeelShade, wetBulbTemperature, wetBulbGlobeTemperature, apparentTemperature |
| 130313 | Humidity | environment.outside.humidity |
Data Flow
AccuWeather API --> AccuWeatherService (extract + convert to SI units)
|
WeatherService (add apparent wind from vessel motion)
|
NMEA2000PathMapper (validate, sanitize, map to SK paths)
|
index.ts emission timer (emit cached delta every N seconds)
|
Signal K server --> NMEA2000 emitter --> marine electronicsDevelopment
See DEVELOPMENT.md for full details.
npm run build # Clean build (types + bundle)
npm run dev # Watch mode with hot reload
npm run test # Tests in watch mode
npm run test:run # Tests once
npm run test:coverage # Coverage report (80% thresholds)
npm run lint # Biome check
npm run lint:fix # Auto-fix
npm run validate # Type-check + lint + tests (runs on pre-commit)Tech Stack
- TypeScript 6.0 (strict, ES2023, ESM)
- Node.js 20.18+
@signalk/server-api2.24+- esbuild 0.28 for bundling
- Biome 2.4 for linting/formatting
- Vitest 4.1 for testing (243 tests)
- Husky + lint-staged for pre-commit hooks
License
Apache-2.0 -- see LICENSE.
Contributing
See CONTRIBUTING.md. Pre-commit hooks enforce formatting and tests automatically.
