signalk-wmo-gust 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,31 @@
3
3
  All notable changes to this project are documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
- ## [0.4.0] - 2026-11-19
6
+ ## 0.4.2
7
+
8
+ _2026-11-19_
9
+
10
+ ### Added
11
+ - Screenshots of the wind history app for the Signal K App Store.
12
+ - Signal K plugin CI (the shared `plugin-ci.yml` workflow), so the App Store shows test results for Linux, Raspberry Pi, macOS and Windows.
13
+
14
+ ### Changed
15
+ - Changelog headings use the plain `## x.y.z` form that the App Store reads.
16
+
17
+ ## 0.4.1
18
+
19
+ _2026-11-19_
20
+
21
+ ### Added
22
+ - The onboard time zone is published as `environment.time.timezoneOffset` and `environment.time.timezoneRegion` (setting **Onboard time zone**; empty uses the server's time zone, `none` turns it off).
23
+
24
+ ### Fixed
25
+ - The wind history app shows local time on chartplotters whose browser runs on UTC, such as Garmin OneHelm: it uses the onboard time zone from Signal K.
26
+ - The app no longer shows stale data on browsers that cache requests, and reloads the charts when it comes back to the foreground.
27
+
28
+ ## 0.4.0
29
+
30
+ _2026-11-19_
7
31
 
8
32
  ### Added
9
33
  - **Wind history web app** (Signal K Web Apps → WMO Wind): charts of the last 1, 3, 24 or 72 hours with the 10-minute mean at 10 m and at sensor height, gusts as WMO 3-second gusts, absolute maxima or both, at 10 m or at sensor height, and arrows for the mean direction. Built for Garmin chartplotters (OneHelm) as well as browsers: touch controls, night mode, and no login needed, as it reads the Signal K History API.
@@ -14,18 +38,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
14
38
  ### Changed
15
39
  - The Web App and App Store name is now **WMO Wind**.
16
40
 
17
- ## [0.3.1] - 2026-11-05
41
+ ## 0.3.1
42
+
43
+ _2026-11-05_
18
44
 
19
45
  ### Added
20
46
  - App icon for the Signal K App Store: a three-cup anemometer and a stopwatch showing the WMO 10-minute averaging window.
21
47
 
22
- ## [0.3.0] - 2026-11-04
48
+ ## 0.3.0
49
+
50
+ _2026-11-04_
23
51
 
24
52
  ### Added
25
53
  - WMO 10-minute mean wind direction (`directionOverGroundMeanWMO`, or `directionTrueMeanWMO` for water-referenced wind), in radians from true north. It is a vector mean weighted by wind speed, so 350° and 10° average to 0°, and it is not published in a calm (mean below 0.5 m/s).
26
54
  - **Wind direction source path** setting, default `environment.wind.directionTrue`.
27
55
 
28
- ## [0.2.0] - 2026-11-04
56
+ ## 0.2.0
57
+
58
+ _2026-11-04_
29
59
 
30
60
  ### Added
31
61
  - Highest WMO gust of the last 1, 3 and 6 hours (`…Max1hWMO`, `…Max3hWMO`, `…Max6hWMO`), for comparison with forecast gusts, which are maxima since the model's previous output step.
@@ -40,7 +70,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
40
70
  ### Fixed
41
71
  - A delta timestamp of exactly 0 ms was taken as missing.
42
72
 
43
- ## [0.1.0] - 2026-11-03
73
+ ## 0.1.0
74
+
75
+ _2026-11-03_
44
76
 
45
77
  ### Added
46
78
  - First version: WMO 10-minute mean wind and 3-second running-mean gust, with power-law height correction from a configured height or `design.airHeight`.
package/README.md CHANGED
@@ -87,6 +87,8 @@ In a current the two differ by roughly the current's speed. In 2 kn of tide, the
87
87
 
88
88
  ## Wind history web app
89
89
 
90
+ ![Wind history app: 24 hours of mean wind at 10 m and at sensor height, WMO gusts and absolute maxima, with direction arrows](screenshots/wind-24h.png)
91
+
90
92
  The plugin includes a web app, **WMO Wind**, under **Web Apps** in the Signal K admin, at `/signalk-wmo-gust/`. It charts the last **1, 3, 24 or 72 hours**:
91
93
 
92
94
  - the 10-minute **mean wind at 10 m** and **at sensor height**;
@@ -130,6 +132,7 @@ Then go to **Server → Plugin Config → WMO Wind**, and enable the plugin.
130
132
  | Anemometer distance below `design.airHeight` (m) | 0.3 | Allows for the sensor sitting below the top of the mast |
131
133
  | Wind profile exponent | 0.11 | 0.11 for open sea, 0.143 for open land, 0 for no correction |
132
134
  | Publish interval (s) | 1 | How often values are published |
135
+ | Onboard time zone | empty | IANA name such as `Europe/Madrid`, published as `environment.time.timezoneOffset` and `timezoneRegion` so that displays running on UTC show local time. Empty: the server's time zone; `none`: not published |
133
136
 
134
137
  The height is re-read on every publish, so a change to `design.airHeight` takes effect without a restart.
135
138
 
package/index.js CHANGED
@@ -39,6 +39,25 @@ const DIR_MAX_AGE_MS = 5000 // a direction older than this is not paired with a
39
39
  const TWO_PI = 2 * Math.PI
40
40
  const FACTOR_PATH = 'environment.wind.heightFactorWMO'
41
41
 
42
+ /** Offset of an IANA time zone from UTC at a moment, as Signal K's (-)hhmm number, e.g. 100 or -530. */
43
+ function timezoneOffset (zone, date) {
44
+ let parts
45
+ try {
46
+ parts = new Intl.DateTimeFormat('en-GB', {
47
+ timeZone: zone, hourCycle: 'h23', year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric'
48
+ }).formatToParts(date)
49
+ } catch (e) {
50
+ return null
51
+ }
52
+ const get = (t) => Number(parts.find((p) => p.type === t).value)
53
+ const local = Date.UTC(get('year'), get('month') - 1, get('day'), get('hour'), get('minute'))
54
+ const utc = Math.floor(date.getTime() / 60000) * 60000
55
+ const min = Math.round((local - utc) / 60000)
56
+ const sign = min < 0 ? -1 : 1
57
+ const a = Math.abs(min)
58
+ return sign * (Math.floor(a / 60) * 100 + (a % 60))
59
+ }
60
+
42
61
  module.exports = function (app) {
43
62
  const plugin = {
44
63
  id: 'signalk-wmo-gust',
@@ -48,6 +67,7 @@ module.exports = function (app) {
48
67
 
49
68
  let unsubscribes = []
50
69
  let timer = null
70
+ let clockTimer = null
51
71
 
52
72
  /*
53
73
  * Published paths: the reference of the source wind, then the quantity,
@@ -111,6 +131,12 @@ module.exports = function (app) {
111
131
  type: 'number',
112
132
  title: 'Publish interval (s)',
113
133
  default: 1
134
+ },
135
+ timezone: {
136
+ type: 'string',
137
+ title: 'Onboard time zone (IANA name, e.g. Europe/Madrid)',
138
+ description: 'Published as environment.time.timezoneOffset and timezoneRegion, so that displays without their own time zone, such as Garmin OneHelm, show local time. Empty: the server\'s time zone. "none": do not publish.',
139
+ default: ''
114
140
  }
115
141
  }
116
142
  }
@@ -264,14 +290,36 @@ module.exports = function (app) {
264
290
  `${rateHz.toFixed(1)} Hz, sensor ${height.h.toFixed(1)} m (${height.src})${filling}${warn}`
265
291
  )
266
292
  }, (options.publishInterval > 0 ? options.publishInterval : 1) * 1000)
293
+
294
+ if (options.timezone !== 'none') {
295
+ const zone = options.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone
296
+ const publishClock = () => {
297
+ const off = timezoneOffset(zone, new Date())
298
+ if (off === null) return app.error(`Unknown time zone ${zone}`)
299
+ app.handleMessage(plugin.id, {
300
+ updates: [{
301
+ values: [
302
+ { path: 'environment.time.timezoneOffset', value: off },
303
+ { path: 'environment.time.timezoneRegion', value: zone }
304
+ ]
305
+ }]
306
+ })
307
+ }
308
+ publishClock()
309
+ clockTimer = setInterval(publishClock, 60000)
310
+ }
267
311
  }
268
312
 
269
313
  plugin.stop = function () {
270
314
  unsubscribes.forEach((f) => f())
271
315
  unsubscribes = []
272
316
  if (timer) clearInterval(timer)
317
+ if (clockTimer) clearInterval(clockTimer)
273
318
  timer = null
319
+ clockTimer = null
274
320
  }
275
321
 
276
322
  return plugin
277
323
  }
324
+
325
+ module.exports.timezoneOffset = timezoneOffset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-wmo-gust",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "WMO-standard 10-minute mean wind, mean direction and 3-second gust for Signal K, with 1/3/6-hour gust maxima, and a web app charting the last 1, 3, 24 and 72 hours",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,10 +34,15 @@
34
34
  "CHANGELOG.md",
35
35
  "LICENSE",
36
36
  "icon.svg",
37
- "public"
37
+ "public",
38
+ "screenshots"
38
39
  ],
39
40
  "signalk": {
40
41
  "displayName": "WMO Wind",
41
- "appIcon": "./icon.svg"
42
+ "appIcon": "./icon.svg",
43
+ "screenshots": [
44
+ "./screenshots/wind-24h.png",
45
+ "./screenshots/wind-24h-night.png"
46
+ ]
42
47
  }
43
48
  }
package/public/index.html CHANGED
@@ -253,8 +253,21 @@
253
253
  function pad3 (n) { return ('00' + n).slice(-3) }
254
254
  function compass (rad) { return COMPASS[Math.round(deg(rad) / 22.5) % 16] }
255
255
  function two (n) { return (n < 10 ? '0' : '') + n }
256
- function hm (t) { var d = new Date(t); return two(d.getHours()) + ':' + two(d.getMinutes()) }
257
- function dm (t) { var d = new Date(t); return two(d.getDate()) + '/' + two(d.getMonth() + 1) }
256
+ // Onboard time zone from Signal K (environment.time.timezoneOffset): chartplotter
257
+ // browsers often run on UTC. Without it, the browser's own time zone is used.
258
+ var tzMs = null
259
+ function offsetAt (t) { return tzMs !== null ? tzMs : -new Date(t).getTimezoneOffset() * 60000 }
260
+ function local (t) { return new Date(t + offsetAt(t)) }
261
+ function hm (t) { var d = local(t); return two(d.getUTCHours()) + ':' + two(d.getUTCMinutes()) }
262
+ function dm (t) { var d = local(t); return two(d.getUTCDate()) + '/' + two(d.getUTCMonth() + 1) }
263
+ function loadClock () {
264
+ getJSON('/signalk/v1/api/vessels/self/environment/time', function (err, tm) {
265
+ setTimeout(loadClock, 60000)
266
+ var v = !err && tm && tm.timezoneOffset && num(tm.timezoneOffset.value) ? tm.timezoneOffset.value : null
267
+ var ms = v === null ? null : (v < 0 ? -1 : 1) * (Math.floor(Math.abs(v) / 100) * 60 + Math.abs(v) % 100) * 60000
268
+ if (ms !== tzMs) { tzMs = ms; draw() }
269
+ })
270
+ }
258
271
 
259
272
  // ---- series -------------------------------------------------------------
260
273
 
@@ -386,7 +399,7 @@
386
399
  }
387
400
 
388
401
  function timeAxis (c, r, start, end, X, yTop, yBottom, rule, muted, labels) {
389
- var off = -new Date(start).getTimezoneOffset() * 60000
402
+ var off = offsetAt(end)
390
403
  var t = Math.ceil((start + off) / r.tick) * r.tick - off
391
404
  c.textAlign = 'center'; c.textBaseline = 'top'
392
405
  for (; t <= end; t += r.tick) {
@@ -574,6 +587,7 @@
574
587
 
575
588
  syncButtons()
576
589
  draw()
590
+ loadClock()
577
591
  loadLive()
578
592
  loadHistory()
579
593
  })()
Binary file
Binary file