signalk-sailorwind-plugin 0.2.0
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/LICENSE +202 -0
- package/README.md +115 -0
- package/dist/index.js +759 -0
- package/dist/index.js.map +7 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# signalk-sailorwind-plugin
|
|
2
|
+
|
|
3
|
+
A [SignalK](https://signalk.org/) server plugin that pushes weather observations from a boat's SignalK server to the [sailorwind](https://sailorwind.net) marine-weather observation service. Once installed and configured with a device token, it aggregates the last 10 minutes of wind / pressure / temperature / humidity samples for the self vessel and POSTs them — fully offline-tolerant, with a persistent retry queue so a flaky cellular link doesn't drop data.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- A SignalK Node server (>= v1.x). Tested against the standard appstore install.
|
|
8
|
+
- A sailorwind account.
|
|
9
|
+
- A **device token** — generate one at <https://sailorwind.net/settings/api-tokens>. Tokens are prefixed `slw_dev_` and should be treated as secrets.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
In the SignalK admin UI:
|
|
14
|
+
|
|
15
|
+
1. Open the **Appstore** tab.
|
|
16
|
+
2. Search for **sailorwind**.
|
|
17
|
+
3. Click **Install** on `signalk-sailorwind-plugin`.
|
|
18
|
+
4. Open the **Server → Plugin Config** tab and find **sailorwind weather submission**.
|
|
19
|
+
|
|
20
|
+
Or from the command line on the SignalK server host:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
cd ~/.signalk
|
|
24
|
+
npm install signalk-sailorwind-plugin
|
|
25
|
+
# then restart the SK server
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Configure
|
|
29
|
+
|
|
30
|
+
In **Server → Plugin Config → sailorwind weather submission**:
|
|
31
|
+
|
|
32
|
+
| Field | Notes |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| sailorwind API base URL | Default `https://sailorwind.net`. Leave as-is unless you've been told otherwise (e.g. during a private test deployment). |
|
|
35
|
+
| Device token | Paste the `slw_dev_...` value from the sailorwind settings page. Treat as a secret. |
|
|
36
|
+
| Fields to submit | Check the boxes for the observations you want to share. **Position is always included** — it's required by the API and is what makes an observation useful. |
|
|
37
|
+
|
|
38
|
+
Hit **Submit**, then toggle the plugin **Enabled**.
|
|
39
|
+
|
|
40
|
+
### What gets sent
|
|
41
|
+
|
|
42
|
+
Every 10 minutes (not user-configurable in v1), the plugin computes one aggregated observation from the samples received during the window and POSTs it to `/v1/observations`:
|
|
43
|
+
|
|
44
|
+
- **position** — latest GPS fix in the window (from `navigation.position`)
|
|
45
|
+
- **wind speed** — arithmetic mean of `environment.wind.speedTrue` (m/s)
|
|
46
|
+
- **wind gust** — max of `environment.wind.speedTrue` over the window
|
|
47
|
+
- **wind direction** — vector mean of `environment.wind.directionTrue` (degrees TRUE, meteorological convention — direction wind is *from*)
|
|
48
|
+
- **pressure** — latest `environment.outside.pressure` (Pa → hPa)
|
|
49
|
+
- **air temp** — latest `environment.outside.temperature` (K → °C)
|
|
50
|
+
- **water temp** — latest `environment.water.temperature` (K → °C)
|
|
51
|
+
- **humidity** — latest `environment.outside.humidity` (0..1 → %)
|
|
52
|
+
|
|
53
|
+
If your sensor stack only publishes `environment.wind.directionMagnetic`, the plugin will log a warning and skip wind direction — sailorwind needs degrees TRUE and v1 of this plugin does not auto-convert magnetic readings (no reliable variation source).
|
|
54
|
+
|
|
55
|
+
## Offline behaviour
|
|
56
|
+
|
|
57
|
+
- Observations are queued to a JSON file under the plugin's data directory (`~/.signalk/plugin-config-data/sailorwind/queue.json` on a typical install).
|
|
58
|
+
- Up to 100 entries (~16 hours of submissions at 10-minute cadence) are buffered. When the cap is hit, oldest entries are dropped first.
|
|
59
|
+
- On reconnect, the queue drains FIFO at the next 10-minute tick.
|
|
60
|
+
- Each entry carries a stable idempotency key, so a retry after a successful-but-unack'd send is deduped server-side.
|
|
61
|
+
|
|
62
|
+
## Status
|
|
63
|
+
|
|
64
|
+
The status line in the plugin admin UI tells you everything:
|
|
65
|
+
|
|
66
|
+
- `Awaiting first submission` — plugin is up but the first 10-minute window hasn't fired yet.
|
|
67
|
+
- `Last sent 2 min ago • queue: 0` — healthy; data is reaching sailorwind.
|
|
68
|
+
- `Last sent 47 min ago • queue: 5` — queue is growing; the API is unreachable (offline, DNS, TLS, or server outage). Will drain on reconnect.
|
|
69
|
+
- `Misconfigured: missing apiToken` — token is empty; paste your device token.
|
|
70
|
+
|
|
71
|
+
## Troubleshooting
|
|
72
|
+
|
|
73
|
+
### Where are the plugin logs?
|
|
74
|
+
|
|
75
|
+
SignalK writes plugin logs to its main log (commonly `~/.signalk/signalk-server.log` or via `journalctl -u signalk` on a service install). Look for lines starting with `sailorwind`.
|
|
76
|
+
|
|
77
|
+
### `permanent 401 dropping entry`
|
|
78
|
+
|
|
79
|
+
The API rejected your token. Most common causes:
|
|
80
|
+
|
|
81
|
+
- Token typo on paste (extra space, missing prefix).
|
|
82
|
+
- Token was revoked in the sailorwind UI.
|
|
83
|
+
- Token belongs to a different account than the vessel you're trying to submit for.
|
|
84
|
+
|
|
85
|
+
Generate a fresh token at <https://sailorwind.net/settings/api-tokens> and paste it in.
|
|
86
|
+
|
|
87
|
+
### `permanent 400`
|
|
88
|
+
|
|
89
|
+
The server rejected the body shape. Usually means a value is out of range (e.g. wind speed > 100 m/s from a stuck anemometer). The full error body is logged. Check your sensors.
|
|
90
|
+
|
|
91
|
+
### `network error, will retry`
|
|
92
|
+
|
|
93
|
+
Transient — the plugin couldn't reach the server. It will retry at the next 10-minute tick. No action needed; check connectivity if it persists.
|
|
94
|
+
|
|
95
|
+
### Submission cadence is wrong for me
|
|
96
|
+
|
|
97
|
+
The 10-minute cadence is fixed in v1. The aggregation window matches sailorwind's grid coarsening — sending faster doesn't get you finer-grained data on the map.
|
|
98
|
+
|
|
99
|
+
## Data, privacy, and license
|
|
100
|
+
|
|
101
|
+
Observations submitted via this plugin are public data on sailorwind, subject to position coarsening as described in the [sailorwind data license](https://sailorwind.net/license). The plugin itself transmits only what you opted into via the **Fields to submit** checkboxes, plus position (always required) and an observation timestamp.
|
|
102
|
+
|
|
103
|
+
The device token is stored in plain text in your SignalK server's config (the same place every other SK plugin stores its config). Don't share screenshots of your plugin-config UI with the token visible.
|
|
104
|
+
|
|
105
|
+
## Internal dependency
|
|
106
|
+
|
|
107
|
+
This plugin imports its aggregation / submission pipeline from the sibling internal package [`sailorwind-integration-core`](../shared) (the same code path the upcoming Capacitor mobile wrap will use). The dep is wired via `file:../shared` for monorepo dev; for an npm release the shared lib is bundled into the plugin's `dist/` before publish. End users installing from the SignalK appstore don't need to know it's there.
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
Apache-2.0. See [LICENSE](./LICENSE) or <https://www.apache.org/licenses/LICENSE-2.0>.
|
|
112
|
+
|
|
113
|
+
## Homepage
|
|
114
|
+
|
|
115
|
+
<https://sailorwind.net>
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// node_modules/.pnpm/sailorwind-integration-core@file+..+shared/node_modules/sailorwind-integration-core/dist/units.js
|
|
26
|
+
function radToDeg(rad) {
|
|
27
|
+
const deg = rad * 180 / Math.PI;
|
|
28
|
+
return wrapDeg(deg);
|
|
29
|
+
}
|
|
30
|
+
function wrapDeg(deg) {
|
|
31
|
+
const wrapped = deg % 360;
|
|
32
|
+
return wrapped < 0 ? wrapped + 360 : wrapped;
|
|
33
|
+
}
|
|
34
|
+
function kelvinToCelsius(k) {
|
|
35
|
+
return k - 273.15;
|
|
36
|
+
}
|
|
37
|
+
function paToHpa(pa) {
|
|
38
|
+
return pa / 100;
|
|
39
|
+
}
|
|
40
|
+
function ratioToPercent(ratio) {
|
|
41
|
+
return ratio * 100;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// node_modules/.pnpm/sailorwind-integration-core@file+..+shared/node_modules/sailorwind-integration-core/dist/aggregator.js
|
|
45
|
+
var Aggregator = class {
|
|
46
|
+
positions = [];
|
|
47
|
+
wind = [];
|
|
48
|
+
/** Pa (SignalK native). Converted at flush. */
|
|
49
|
+
pressure = [];
|
|
50
|
+
/** K (SignalK native). Converted at flush. */
|
|
51
|
+
airTemp = [];
|
|
52
|
+
/** K (SignalK native). Converted at flush. */
|
|
53
|
+
waterTemp = [];
|
|
54
|
+
/** 0..1 ratio (SignalK native). Converted at flush. */
|
|
55
|
+
humidity = [];
|
|
56
|
+
addPosition(lat, lon, t = Date.now()) {
|
|
57
|
+
if (!Number.isFinite(lat) || !Number.isFinite(lon))
|
|
58
|
+
return;
|
|
59
|
+
this.positions.push({ lat, lon, t });
|
|
60
|
+
}
|
|
61
|
+
addWindSpeed(speedMs, t = Date.now()) {
|
|
62
|
+
if (!Number.isFinite(speedMs))
|
|
63
|
+
return;
|
|
64
|
+
this.wind.push({ speedMs, t });
|
|
65
|
+
}
|
|
66
|
+
addWindDirection(dirRadTrue, t = Date.now()) {
|
|
67
|
+
if (!Number.isFinite(dirRadTrue))
|
|
68
|
+
return;
|
|
69
|
+
this.wind.push({ dirRadTrue, t });
|
|
70
|
+
}
|
|
71
|
+
addPressure(pa, t = Date.now()) {
|
|
72
|
+
if (!Number.isFinite(pa))
|
|
73
|
+
return;
|
|
74
|
+
this.pressure.push({ value: pa, t });
|
|
75
|
+
}
|
|
76
|
+
addAirTemp(kelvin, t = Date.now()) {
|
|
77
|
+
if (!Number.isFinite(kelvin))
|
|
78
|
+
return;
|
|
79
|
+
this.airTemp.push({ value: kelvin, t });
|
|
80
|
+
}
|
|
81
|
+
addWaterTemp(kelvin, t = Date.now()) {
|
|
82
|
+
if (!Number.isFinite(kelvin))
|
|
83
|
+
return;
|
|
84
|
+
this.waterTemp.push({ value: kelvin, t });
|
|
85
|
+
}
|
|
86
|
+
addHumidity(ratio, t = Date.now()) {
|
|
87
|
+
if (!Number.isFinite(ratio))
|
|
88
|
+
return;
|
|
89
|
+
this.humidity.push({ value: ratio, t });
|
|
90
|
+
}
|
|
91
|
+
/** Drop all samples (called after a successful flush or on plugin stop). */
|
|
92
|
+
reset() {
|
|
93
|
+
this.positions = [];
|
|
94
|
+
this.wind = [];
|
|
95
|
+
this.pressure = [];
|
|
96
|
+
this.airTemp = [];
|
|
97
|
+
this.waterTemp = [];
|
|
98
|
+
this.humidity = [];
|
|
99
|
+
}
|
|
100
|
+
/** True if no usable position has been seen in this window. */
|
|
101
|
+
isEmpty() {
|
|
102
|
+
return this.positions.length === 0;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Compute the aggregated observation for this window.
|
|
106
|
+
*
|
|
107
|
+
* Returns null when there is no position — submission requires a fix.
|
|
108
|
+
* Caller is responsible for calling reset() afterwards.
|
|
109
|
+
*
|
|
110
|
+
* `now` is injectable for deterministic tests.
|
|
111
|
+
*/
|
|
112
|
+
flush(now = Date.now()) {
|
|
113
|
+
if (this.positions.length === 0)
|
|
114
|
+
return null;
|
|
115
|
+
const latestPos = this.positions[this.positions.length - 1];
|
|
116
|
+
const windTimed = this.wind.filter((s) => s.speedMs !== void 0).map((s) => ({ v: s.speedMs, t: s.t }));
|
|
117
|
+
const windSpeedSamples = windTimed.map((s) => s.v);
|
|
118
|
+
const windDirSamples = this.wind.map((s) => s.dirRadTrue).filter((v) => v !== void 0);
|
|
119
|
+
const latestT = Math.max(latestPos.t, ...this.wind.map((s) => s.t), ...this.pressure.map((s) => s.t), ...this.airTemp.map((s) => s.t), ...this.waterTemp.map((s) => s.t), ...this.humidity.map((s) => s.t));
|
|
120
|
+
const observedAtMs = Number.isFinite(latestT) ? latestT : now;
|
|
121
|
+
const obs = {
|
|
122
|
+
observedAt: new Date(observedAtMs).toISOString(),
|
|
123
|
+
latDeg: latestPos.lat,
|
|
124
|
+
lonDeg: latestPos.lon
|
|
125
|
+
};
|
|
126
|
+
if (windSpeedSamples.length > 0) {
|
|
127
|
+
const meanMs = mean(windSpeedSamples);
|
|
128
|
+
const stdMs = populationStd(windSpeedSamples);
|
|
129
|
+
obs.windSpeedMs = meanMs;
|
|
130
|
+
obs.windGustMs = Math.max(...windSpeedSamples);
|
|
131
|
+
obs.windSpeedStdMs = stdMs;
|
|
132
|
+
obs.windGustCrossings = gustCrossings(windSpeedSamples, meanMs + stdMs);
|
|
133
|
+
obs.windSpeedHistogram = speedHistogram(windSpeedSamples);
|
|
134
|
+
obs.windGust10sMs = peakSustained(windTimed, 1e4);
|
|
135
|
+
obs.windGust30sMs = peakSustained(windTimed, 3e4);
|
|
136
|
+
obs.windGust60sMs = peakSustained(windTimed, 6e4);
|
|
137
|
+
}
|
|
138
|
+
if (windDirSamples.length > 0) {
|
|
139
|
+
obs.windFromDeg = vectorMeanDeg(windDirSamples);
|
|
140
|
+
}
|
|
141
|
+
if (this.pressure.length > 0) {
|
|
142
|
+
obs.pressureHpa = paToHpa(latestNonNull(this.pressure));
|
|
143
|
+
}
|
|
144
|
+
if (this.airTemp.length > 0) {
|
|
145
|
+
obs.airTempC = kelvinToCelsius(latestNonNull(this.airTemp));
|
|
146
|
+
}
|
|
147
|
+
if (this.waterTemp.length > 0) {
|
|
148
|
+
obs.sstC = kelvinToCelsius(latestNonNull(this.waterTemp));
|
|
149
|
+
}
|
|
150
|
+
if (this.humidity.length > 0) {
|
|
151
|
+
obs.relativeHumidityPct = ratioToPercent(latestNonNull(this.humidity));
|
|
152
|
+
}
|
|
153
|
+
return obs;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
function mean(xs) {
|
|
157
|
+
if (xs.length === 0)
|
|
158
|
+
return NaN;
|
|
159
|
+
let sum = 0;
|
|
160
|
+
for (const x of xs)
|
|
161
|
+
sum += x;
|
|
162
|
+
return sum / xs.length;
|
|
163
|
+
}
|
|
164
|
+
function vectorMeanDeg(radians) {
|
|
165
|
+
if (radians.length === 0)
|
|
166
|
+
return NaN;
|
|
167
|
+
let sumSin = 0;
|
|
168
|
+
let sumCos = 0;
|
|
169
|
+
for (const r of radians) {
|
|
170
|
+
sumSin += Math.sin(r);
|
|
171
|
+
sumCos += Math.cos(r);
|
|
172
|
+
}
|
|
173
|
+
const meanRad = Math.atan2(sumSin, sumCos);
|
|
174
|
+
return wrapDeg(radToDeg(meanRad));
|
|
175
|
+
}
|
|
176
|
+
function latestNonNull(samples) {
|
|
177
|
+
return samples[samples.length - 1].value;
|
|
178
|
+
}
|
|
179
|
+
var WIND_HISTOGRAM_BINS = 40;
|
|
180
|
+
function populationStd(xs) {
|
|
181
|
+
if (xs.length === 0)
|
|
182
|
+
return NaN;
|
|
183
|
+
const m = mean(xs);
|
|
184
|
+
let acc = 0;
|
|
185
|
+
for (const x of xs)
|
|
186
|
+
acc += (x - m) * (x - m);
|
|
187
|
+
return Math.sqrt(acc / xs.length);
|
|
188
|
+
}
|
|
189
|
+
function speedHistogram(xs) {
|
|
190
|
+
const bins = new Array(WIND_HISTOGRAM_BINS).fill(0);
|
|
191
|
+
for (const v of xs) {
|
|
192
|
+
if (!Number.isFinite(v) || v < 0)
|
|
193
|
+
continue;
|
|
194
|
+
const idx = Math.min(WIND_HISTOGRAM_BINS - 1, Math.floor(v));
|
|
195
|
+
bins[idx] = bins[idx] + 1;
|
|
196
|
+
}
|
|
197
|
+
return bins;
|
|
198
|
+
}
|
|
199
|
+
function gustCrossings(xs, level) {
|
|
200
|
+
let count = 0;
|
|
201
|
+
for (let i = 1; i < xs.length; i++) {
|
|
202
|
+
if (xs[i - 1] < level && xs[i] >= level)
|
|
203
|
+
count += 1;
|
|
204
|
+
}
|
|
205
|
+
return count;
|
|
206
|
+
}
|
|
207
|
+
function peakSustained(samples, windowMs) {
|
|
208
|
+
const n = samples.length;
|
|
209
|
+
if (n === 0)
|
|
210
|
+
return NaN;
|
|
211
|
+
const prefix = new Array(n + 1);
|
|
212
|
+
prefix[0] = 0;
|
|
213
|
+
for (let i = 0; i < n; i++)
|
|
214
|
+
prefix[i + 1] = prefix[i] + samples[i].v;
|
|
215
|
+
const lastT = samples[n - 1].t;
|
|
216
|
+
let peak = Number.NEGATIVE_INFINITY;
|
|
217
|
+
let j = 0;
|
|
218
|
+
for (let i = 0; i < n; i++) {
|
|
219
|
+
const start = samples[i].t;
|
|
220
|
+
if (start + windowMs > lastT)
|
|
221
|
+
break;
|
|
222
|
+
if (j < i)
|
|
223
|
+
j = i;
|
|
224
|
+
while (j < n && samples[j].t < start + windowMs)
|
|
225
|
+
j++;
|
|
226
|
+
const meanInWindow = (prefix[j] - prefix[i]) / (j - i);
|
|
227
|
+
if (meanInWindow > peak)
|
|
228
|
+
peak = meanInWindow;
|
|
229
|
+
}
|
|
230
|
+
return peak === Number.NEGATIVE_INFINITY ? mean(samples.map((s) => s.v)) : peak;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// node_modules/.pnpm/sailorwind-integration-core@file+..+shared/node_modules/sailorwind-integration-core/dist/submitter.js
|
|
234
|
+
var import_uuid = require("uuid");
|
|
235
|
+
var MAX_QUEUE = 100;
|
|
236
|
+
var Submitter = class {
|
|
237
|
+
queue = [];
|
|
238
|
+
lastSuccessAt;
|
|
239
|
+
loaded = false;
|
|
240
|
+
serverUrl;
|
|
241
|
+
apiToken;
|
|
242
|
+
queueStore;
|
|
243
|
+
fetchImpl;
|
|
244
|
+
debug;
|
|
245
|
+
error;
|
|
246
|
+
constructor(deps) {
|
|
247
|
+
this.serverUrl = deps.serverUrl.replace(/\/+$/, "");
|
|
248
|
+
this.apiToken = deps.apiToken;
|
|
249
|
+
this.queueStore = deps.queueStore;
|
|
250
|
+
this.fetchImpl = deps.fetchImpl ?? globalThis.fetch;
|
|
251
|
+
this.debug = deps.debug ?? (() => {
|
|
252
|
+
});
|
|
253
|
+
this.error = deps.error ?? (() => {
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/** Load the persisted queue from the store. Safe to call multiple times. */
|
|
257
|
+
async load() {
|
|
258
|
+
if (this.loaded)
|
|
259
|
+
return;
|
|
260
|
+
this.loaded = true;
|
|
261
|
+
try {
|
|
262
|
+
this.queue = await this.queueStore.load();
|
|
263
|
+
} catch (err) {
|
|
264
|
+
this.error(`queue load failed, starting empty: ${String(err)}`);
|
|
265
|
+
this.queue = [];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/** Append an observation, persist, and bound the queue at MAX_QUEUE entries. */
|
|
269
|
+
async enqueue(body) {
|
|
270
|
+
await this.load();
|
|
271
|
+
const entry = {
|
|
272
|
+
idempotencyKey: (0, import_uuid.v4)(),
|
|
273
|
+
body,
|
|
274
|
+
enqueuedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
275
|
+
};
|
|
276
|
+
this.queue.push(entry);
|
|
277
|
+
if (this.queue.length > MAX_QUEUE) {
|
|
278
|
+
const dropped = this.queue.length - MAX_QUEUE;
|
|
279
|
+
this.queue.splice(0, dropped);
|
|
280
|
+
this.debug(`queue at cap (${MAX_QUEUE}), dropped ${dropped} oldest entries`);
|
|
281
|
+
}
|
|
282
|
+
await this.persist();
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Attempt to send every queued entry, in order. Stops on the first
|
|
286
|
+
* retainable failure (5xx / 408 / 429 / network error) so we don't hammer
|
|
287
|
+
* the server when it's already complaining. Drops 4xx (other than 408/429)
|
|
288
|
+
* — those are permanent errors a retry won't fix.
|
|
289
|
+
*/
|
|
290
|
+
async drain() {
|
|
291
|
+
await this.load();
|
|
292
|
+
let sent = 0;
|
|
293
|
+
let mutated = false;
|
|
294
|
+
while (this.queue.length > 0) {
|
|
295
|
+
const entry = this.queue[0];
|
|
296
|
+
const outcome = await this.send(entry);
|
|
297
|
+
if (outcome === "success") {
|
|
298
|
+
this.queue.shift();
|
|
299
|
+
sent++;
|
|
300
|
+
mutated = true;
|
|
301
|
+
this.lastSuccessAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
302
|
+
} else if (outcome === "drop") {
|
|
303
|
+
this.queue.shift();
|
|
304
|
+
mutated = true;
|
|
305
|
+
} else {
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (mutated) {
|
|
310
|
+
await this.persist();
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
sent,
|
|
314
|
+
queueDepth: this.queue.length,
|
|
315
|
+
...this.lastSuccessAt && { lastSuccessAt: this.lastSuccessAt }
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/** Total queued + last success timestamp (for statusMessage). */
|
|
319
|
+
getState() {
|
|
320
|
+
return {
|
|
321
|
+
queueDepth: this.queue.length,
|
|
322
|
+
...this.lastSuccessAt && { lastSuccessAt: this.lastSuccessAt }
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
async send(entry) {
|
|
326
|
+
const url = `${this.serverUrl}/v1/observations`;
|
|
327
|
+
try {
|
|
328
|
+
const headers = {
|
|
329
|
+
"Content-Type": "application/json",
|
|
330
|
+
"Idempotency-Key": entry.idempotencyKey
|
|
331
|
+
};
|
|
332
|
+
if (this.apiToken) {
|
|
333
|
+
headers.Authorization = `Bearer ${this.apiToken}`;
|
|
334
|
+
}
|
|
335
|
+
const res = await this.fetchImpl(url, {
|
|
336
|
+
method: "POST",
|
|
337
|
+
headers,
|
|
338
|
+
// No-op for cross-origin fetch in Node tests; in the browser it
|
|
339
|
+
// tells fetch to include the session cookie. Safe to set
|
|
340
|
+
// unconditionally — when apiToken IS provided the server will
|
|
341
|
+
// accept the Bearer header and ignore the (likely absent) cookie.
|
|
342
|
+
credentials: "include",
|
|
343
|
+
body: JSON.stringify(entry.body)
|
|
344
|
+
});
|
|
345
|
+
if (res.status >= 200 && res.status < 300) {
|
|
346
|
+
this.debug(`POST /v1/observations ${res.status}`);
|
|
347
|
+
return "success";
|
|
348
|
+
}
|
|
349
|
+
if (res.status === 408 || res.status === 429) {
|
|
350
|
+
this.debug(`transient ${res.status} \u2014 will retry`);
|
|
351
|
+
return "retain";
|
|
352
|
+
}
|
|
353
|
+
if (res.status >= 500) {
|
|
354
|
+
this.debug(`server ${res.status} \u2014 will retry`);
|
|
355
|
+
return "retain";
|
|
356
|
+
}
|
|
357
|
+
const bodyText = await safeReadText(res);
|
|
358
|
+
this.error(`permanent ${res.status} dropping entry \u2014 body: ${truncate(bodyText, 200)}`);
|
|
359
|
+
return "drop";
|
|
360
|
+
} catch (err) {
|
|
361
|
+
this.debug(`network error, will retry: ${String(err)}`);
|
|
362
|
+
return "retain";
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
async persist() {
|
|
366
|
+
try {
|
|
367
|
+
await this.queueStore.save(this.queue);
|
|
368
|
+
} catch (err) {
|
|
369
|
+
this.error(`queue persist failed: ${String(err)}`);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
async function safeReadText(res) {
|
|
374
|
+
try {
|
|
375
|
+
return await res.text();
|
|
376
|
+
} catch {
|
|
377
|
+
return "";
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function truncate(s, n) {
|
|
381
|
+
return s.length <= n ? s : `${s.slice(0, n)}\u2026`;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// node_modules/.pnpm/sailorwind-integration-core@file+..+shared/node_modules/sailorwind-integration-core/dist/queue/fs-queue-store.js
|
|
385
|
+
var import_node_fs = require("node:fs");
|
|
386
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
387
|
+
var QUEUE_FILENAME = "queue.json";
|
|
388
|
+
var FsQueueStore = class {
|
|
389
|
+
dataDirPath;
|
|
390
|
+
debug;
|
|
391
|
+
error;
|
|
392
|
+
constructor(opts) {
|
|
393
|
+
this.dataDirPath = opts.dataDirPath;
|
|
394
|
+
this.debug = opts.debug ?? (() => {
|
|
395
|
+
});
|
|
396
|
+
this.error = opts.error ?? (() => {
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
async load() {
|
|
400
|
+
const queuePath = import_node_path.default.join(this.dataDirPath, QUEUE_FILENAME);
|
|
401
|
+
try {
|
|
402
|
+
const raw = await import_node_fs.promises.readFile(queuePath, "utf-8");
|
|
403
|
+
const parsed = JSON.parse(raw);
|
|
404
|
+
if (!Array.isArray(parsed))
|
|
405
|
+
return [];
|
|
406
|
+
const entries = parsed.filter((e) => !!e && typeof e.idempotencyKey === "string" && typeof e.body === "object" && e.body !== null).map((e) => ({
|
|
407
|
+
idempotencyKey: e.idempotencyKey,
|
|
408
|
+
body: e.body,
|
|
409
|
+
enqueuedAt: typeof e.enqueuedAt === "string" ? e.enqueuedAt : (/* @__PURE__ */ new Date(0)).toISOString()
|
|
410
|
+
}));
|
|
411
|
+
this.debug(`loaded ${entries.length} queued observation(s)`);
|
|
412
|
+
return entries;
|
|
413
|
+
} catch (err) {
|
|
414
|
+
const code = err.code;
|
|
415
|
+
if (code !== "ENOENT") {
|
|
416
|
+
this.error(`queue load failed, starting empty: ${String(err)}`);
|
|
417
|
+
}
|
|
418
|
+
return [];
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
async save(entries) {
|
|
422
|
+
const queuePath = import_node_path.default.join(this.dataDirPath, QUEUE_FILENAME);
|
|
423
|
+
try {
|
|
424
|
+
await import_node_fs.promises.mkdir(this.dataDirPath, { recursive: true });
|
|
425
|
+
await import_node_fs.promises.writeFile(queuePath, JSON.stringify(entries), "utf-8");
|
|
426
|
+
} catch (err) {
|
|
427
|
+
this.error(`queue persist failed: ${String(err)}`);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// src/index.ts
|
|
433
|
+
var PLUGIN_ID = "sailorwind";
|
|
434
|
+
var PLUGIN_NAME = "sailorwind weather submission";
|
|
435
|
+
var DEFAULT_SERVER_URL = "https://sailorwind.net";
|
|
436
|
+
var SUBMIT_INTERVAL_MS = 10 * 60 * 1e3;
|
|
437
|
+
var FIRST_SUBMISSION_DELAY_MS = 60 * 1e3;
|
|
438
|
+
var PATHS = {
|
|
439
|
+
position: "navigation.position",
|
|
440
|
+
windDirection: "environment.wind.directionTrue",
|
|
441
|
+
windSpeed: "environment.wind.speedTrue",
|
|
442
|
+
pressure: "environment.outside.pressure",
|
|
443
|
+
airTemp: "environment.outside.temperature",
|
|
444
|
+
waterTemp: "environment.water.temperature",
|
|
445
|
+
humidity: "environment.outside.humidity"
|
|
446
|
+
};
|
|
447
|
+
function pluginFactory(app) {
|
|
448
|
+
let aggregator = null;
|
|
449
|
+
let submitter = null;
|
|
450
|
+
let intervalHandle = null;
|
|
451
|
+
let firstSubmissionHandle = null;
|
|
452
|
+
let unsubscribers = [];
|
|
453
|
+
let deltaHandler = null;
|
|
454
|
+
let enabledFields = /* @__PURE__ */ new Set();
|
|
455
|
+
let warnedMagneticOnly = false;
|
|
456
|
+
let status = "Not started";
|
|
457
|
+
function start(options) {
|
|
458
|
+
if (!options || typeof options.apiToken !== "string" || options.apiToken === "") {
|
|
459
|
+
app.error(
|
|
460
|
+
"apiToken is required \u2014 get one from the Settings gear in the sailorwind web app"
|
|
461
|
+
);
|
|
462
|
+
status = "Misconfigured: missing apiToken";
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
const serverUrl = options.serverUrl || DEFAULT_SERVER_URL;
|
|
466
|
+
if (typeof serverUrl !== "string") {
|
|
467
|
+
app.error("serverUrl must be a string");
|
|
468
|
+
status = "Misconfigured: invalid serverUrl";
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
enabledFields = new Set(options.fields ?? []);
|
|
472
|
+
aggregator = new Aggregator();
|
|
473
|
+
const queueStore = new FsQueueStore({
|
|
474
|
+
dataDirPath: app.getDataDirPath(),
|
|
475
|
+
debug: (m) => app.debug(m),
|
|
476
|
+
error: (m) => app.error(m)
|
|
477
|
+
});
|
|
478
|
+
submitter = new Submitter({
|
|
479
|
+
serverUrl,
|
|
480
|
+
apiToken: options.apiToken,
|
|
481
|
+
queueStore,
|
|
482
|
+
debug: (m) => app.debug(m),
|
|
483
|
+
error: (m) => app.error(m)
|
|
484
|
+
});
|
|
485
|
+
submitter.load().catch((err) => app.error(`queue load: ${String(err)}`));
|
|
486
|
+
subscribe(app, enabledFields, {
|
|
487
|
+
onPosition: (lat, lon, t) => aggregator?.addPosition(lat, lon, t),
|
|
488
|
+
onWindSpeed: (v, t) => aggregator?.addWindSpeed(v, t),
|
|
489
|
+
onWindDirTrue: (v, t) => aggregator?.addWindDirection(v, t),
|
|
490
|
+
onWindDirMagneticOnly: () => {
|
|
491
|
+
if (!warnedMagneticOnly) {
|
|
492
|
+
warnedMagneticOnly = true;
|
|
493
|
+
app.error(
|
|
494
|
+
"wind direction is published as magnetic only; sailorwind needs degrees TRUE \u2014 skipping wind dir for this vessel until directionTrue is available"
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
onPressure: (v, t) => aggregator?.addPressure(v, t),
|
|
499
|
+
onAirTemp: (v, t) => aggregator?.addAirTemp(v, t),
|
|
500
|
+
onWaterTemp: (v, t) => aggregator?.addWaterTemp(v, t),
|
|
501
|
+
onHumidity: (v, t) => aggregator?.addHumidity(v, t)
|
|
502
|
+
}).then(
|
|
503
|
+
({ unsubscribe, delta }) => {
|
|
504
|
+
unsubscribers = unsubscribe;
|
|
505
|
+
deltaHandler = delta;
|
|
506
|
+
},
|
|
507
|
+
(err) => app.error(`subscribe failed: ${String(err)}`)
|
|
508
|
+
);
|
|
509
|
+
firstSubmissionHandle = setTimeout(() => {
|
|
510
|
+
firstSubmissionHandle = null;
|
|
511
|
+
void submit();
|
|
512
|
+
intervalHandle = setInterval(() => {
|
|
513
|
+
void submit();
|
|
514
|
+
}, SUBMIT_INTERVAL_MS);
|
|
515
|
+
}, FIRST_SUBMISSION_DELAY_MS);
|
|
516
|
+
status = "Awaiting first submission";
|
|
517
|
+
app.debug(
|
|
518
|
+
`started; first submission in ${FIRST_SUBMISSION_DELAY_MS}ms, then every ${SUBMIT_INTERVAL_MS}ms`
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
async function submit() {
|
|
522
|
+
if (!aggregator || !submitter) return;
|
|
523
|
+
if (aggregator.isEmpty()) {
|
|
524
|
+
app.debug("window had no position \u2014 skipping submission");
|
|
525
|
+
const drainState2 = await submitter.drain();
|
|
526
|
+
status = formatStatus(drainState2.lastSuccessAt, drainState2.queueDepth);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
const agg = aggregator.flush();
|
|
530
|
+
aggregator.reset();
|
|
531
|
+
if (!agg) return;
|
|
532
|
+
const body = buildObservation(agg, enabledFields);
|
|
533
|
+
await submitter.enqueue(body);
|
|
534
|
+
const drainState = await submitter.drain();
|
|
535
|
+
status = formatStatus(drainState.lastSuccessAt, drainState.queueDepth);
|
|
536
|
+
}
|
|
537
|
+
function stop() {
|
|
538
|
+
if (firstSubmissionHandle) {
|
|
539
|
+
clearTimeout(firstSubmissionHandle);
|
|
540
|
+
firstSubmissionHandle = null;
|
|
541
|
+
}
|
|
542
|
+
if (intervalHandle) {
|
|
543
|
+
clearInterval(intervalHandle);
|
|
544
|
+
intervalHandle = null;
|
|
545
|
+
}
|
|
546
|
+
for (const u of unsubscribers) {
|
|
547
|
+
try {
|
|
548
|
+
u();
|
|
549
|
+
} catch (err) {
|
|
550
|
+
app.debug(`unsubscribe error: ${String(err)}`);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
unsubscribers = [];
|
|
554
|
+
if (deltaHandler && app.signalk) {
|
|
555
|
+
app.signalk.removeListener("delta", deltaHandler);
|
|
556
|
+
deltaHandler = null;
|
|
557
|
+
}
|
|
558
|
+
aggregator = null;
|
|
559
|
+
submitter = null;
|
|
560
|
+
status = "Stopped";
|
|
561
|
+
app.debug("stopped");
|
|
562
|
+
}
|
|
563
|
+
function statusMessage() {
|
|
564
|
+
return status;
|
|
565
|
+
}
|
|
566
|
+
return {
|
|
567
|
+
id: PLUGIN_ID,
|
|
568
|
+
name: PLUGIN_NAME,
|
|
569
|
+
description: "Pushes weather observations to sailorwind.net",
|
|
570
|
+
schema: {
|
|
571
|
+
type: "object",
|
|
572
|
+
required: ["serverUrl", "apiToken"],
|
|
573
|
+
properties: {
|
|
574
|
+
serverUrl: {
|
|
575
|
+
type: "string",
|
|
576
|
+
default: DEFAULT_SERVER_URL,
|
|
577
|
+
title: "sailorwind API base URL"
|
|
578
|
+
},
|
|
579
|
+
apiToken: {
|
|
580
|
+
type: "string",
|
|
581
|
+
title: "Device token (slw_dev_...)",
|
|
582
|
+
description: "Treat as a secret. Generate it by opening https://sailorwind.net, signing in, and clicking the gear icon (Settings) in the user menu."
|
|
583
|
+
},
|
|
584
|
+
fields: {
|
|
585
|
+
type: "array",
|
|
586
|
+
title: "Fields to submit (position is always included)",
|
|
587
|
+
items: {
|
|
588
|
+
type: "string",
|
|
589
|
+
enum: [
|
|
590
|
+
"windSpeed",
|
|
591
|
+
"windDirection",
|
|
592
|
+
"pressure",
|
|
593
|
+
"airTemp",
|
|
594
|
+
"waterTemp",
|
|
595
|
+
"humidity"
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
uniqueItems: true,
|
|
599
|
+
default: ["windSpeed", "windDirection"]
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
// Newer SK admin UIs honour uiSchema for widget hints. Older ones ignore it.
|
|
604
|
+
uiSchema: {
|
|
605
|
+
apiToken: { "ui:widget": "password" }
|
|
606
|
+
},
|
|
607
|
+
start,
|
|
608
|
+
stop,
|
|
609
|
+
statusMessage
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
async function subscribe(app, fields, cb) {
|
|
613
|
+
const unsubscribe = [];
|
|
614
|
+
const wantPaths = [
|
|
615
|
+
{ path: PATHS.position, kind: "position" }
|
|
616
|
+
// always
|
|
617
|
+
];
|
|
618
|
+
if (fields.has("windSpeed")) {
|
|
619
|
+
wantPaths.push({ path: PATHS.windSpeed, kind: "windSpeed" });
|
|
620
|
+
}
|
|
621
|
+
if (fields.has("windDirection")) {
|
|
622
|
+
wantPaths.push({ path: PATHS.windDirection, kind: "windDirection" });
|
|
623
|
+
}
|
|
624
|
+
if (fields.has("pressure")) {
|
|
625
|
+
wantPaths.push({ path: PATHS.pressure, kind: "pressure" });
|
|
626
|
+
}
|
|
627
|
+
if (fields.has("airTemp")) {
|
|
628
|
+
wantPaths.push({ path: PATHS.airTemp, kind: "airTemp" });
|
|
629
|
+
}
|
|
630
|
+
if (fields.has("waterTemp")) {
|
|
631
|
+
wantPaths.push({ path: PATHS.waterTemp, kind: "waterTemp" });
|
|
632
|
+
}
|
|
633
|
+
if (fields.has("humidity")) {
|
|
634
|
+
wantPaths.push({ path: PATHS.humidity, kind: "humidity" });
|
|
635
|
+
}
|
|
636
|
+
if (app.streamBundle?.getSelfBus) {
|
|
637
|
+
for (const { path: path2, kind } of wantPaths) {
|
|
638
|
+
const bus = app.streamBundle.getSelfBus(path2);
|
|
639
|
+
const off = bus.onValue((v) => {
|
|
640
|
+
handlePathValue(kind, v.value, parseTs(v.timestamp), cb);
|
|
641
|
+
});
|
|
642
|
+
unsubscribe.push(off);
|
|
643
|
+
}
|
|
644
|
+
return { unsubscribe, delta: null };
|
|
645
|
+
}
|
|
646
|
+
if (app.signalk?.on) {
|
|
647
|
+
const wantSet = new Set(wantPaths.map((p) => p.path));
|
|
648
|
+
const handler = (d) => {
|
|
649
|
+
if (d.context && app.selfContext && d.context !== app.selfContext) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
for (const update of d.updates ?? []) {
|
|
653
|
+
const ts = parseTs(update.timestamp);
|
|
654
|
+
for (const v of update.values ?? []) {
|
|
655
|
+
if (!wantSet.has(v.path)) continue;
|
|
656
|
+
const kind = pathToKind(v.path);
|
|
657
|
+
if (kind) handlePathValue(kind, v.value, ts, cb);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
app.signalk.on("delta", handler);
|
|
662
|
+
return { unsubscribe, delta: handler };
|
|
663
|
+
}
|
|
664
|
+
app.error(
|
|
665
|
+
"neither streamBundle.getSelfBus nor signalk.on('delta') is available \u2014 plugin cannot receive data"
|
|
666
|
+
);
|
|
667
|
+
return { unsubscribe, delta: null };
|
|
668
|
+
}
|
|
669
|
+
function pathToKind(p) {
|
|
670
|
+
for (const [k, v] of Object.entries(PATHS)) {
|
|
671
|
+
if (v === p) return k;
|
|
672
|
+
}
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
function handlePathValue(kind, value, t, cb) {
|
|
676
|
+
if (kind === "position") {
|
|
677
|
+
if (typeof value === "object" && value !== null) {
|
|
678
|
+
const v = value;
|
|
679
|
+
if (typeof v.latitude === "number" && typeof v.longitude === "number") {
|
|
680
|
+
cb.onPosition(v.latitude, v.longitude, t);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return;
|
|
686
|
+
switch (kind) {
|
|
687
|
+
case "windSpeed":
|
|
688
|
+
cb.onWindSpeed(value, t);
|
|
689
|
+
break;
|
|
690
|
+
case "windDirection":
|
|
691
|
+
cb.onWindDirTrue(value, t);
|
|
692
|
+
break;
|
|
693
|
+
case "pressure":
|
|
694
|
+
cb.onPressure(value, t);
|
|
695
|
+
break;
|
|
696
|
+
case "airTemp":
|
|
697
|
+
cb.onAirTemp(value, t);
|
|
698
|
+
break;
|
|
699
|
+
case "waterTemp":
|
|
700
|
+
cb.onWaterTemp(value, t);
|
|
701
|
+
break;
|
|
702
|
+
case "humidity":
|
|
703
|
+
cb.onHumidity(value, t);
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function parseTs(s) {
|
|
708
|
+
if (!s) return Date.now();
|
|
709
|
+
const ms = Date.parse(s);
|
|
710
|
+
return Number.isFinite(ms) ? ms : Date.now();
|
|
711
|
+
}
|
|
712
|
+
function buildObservation(agg, fields) {
|
|
713
|
+
const out = {
|
|
714
|
+
observedAt: agg.observedAt,
|
|
715
|
+
position: { lat: agg.latDeg, lon: agg.lonDeg },
|
|
716
|
+
positionSource: "gps",
|
|
717
|
+
source: "auto_signalk"
|
|
718
|
+
};
|
|
719
|
+
if (fields.has("windSpeed")) {
|
|
720
|
+
if (agg.windSpeedMs !== void 0) out.windSpeedMs = agg.windSpeedMs;
|
|
721
|
+
if (agg.windGustMs !== void 0) out.windGustMs = agg.windGustMs;
|
|
722
|
+
if (agg.windGust10sMs !== void 0) out.windGust10sMs = agg.windGust10sMs;
|
|
723
|
+
if (agg.windGust30sMs !== void 0) out.windGust30sMs = agg.windGust30sMs;
|
|
724
|
+
if (agg.windGust60sMs !== void 0) out.windGust60sMs = agg.windGust60sMs;
|
|
725
|
+
if (agg.windSpeedStdMs !== void 0) out.windSpeedStdMs = agg.windSpeedStdMs;
|
|
726
|
+
if (agg.windGustCrossings !== void 0)
|
|
727
|
+
out.windGustCrossings = agg.windGustCrossings;
|
|
728
|
+
if (agg.windSpeedHistogram !== void 0)
|
|
729
|
+
out.windSpeedHistogram = agg.windSpeedHistogram;
|
|
730
|
+
}
|
|
731
|
+
if (fields.has("windDirection") && agg.windFromDeg !== void 0) {
|
|
732
|
+
out.windDirDegFrom = agg.windFromDeg;
|
|
733
|
+
}
|
|
734
|
+
if (fields.has("pressure") && agg.pressureHpa !== void 0) {
|
|
735
|
+
out.pressureHpa = agg.pressureHpa;
|
|
736
|
+
}
|
|
737
|
+
if (fields.has("airTemp") && agg.airTempC !== void 0) {
|
|
738
|
+
out.airTempC = agg.airTempC;
|
|
739
|
+
}
|
|
740
|
+
if (fields.has("waterTemp") && agg.sstC !== void 0) {
|
|
741
|
+
out.sstC = agg.sstC;
|
|
742
|
+
}
|
|
743
|
+
if (fields.has("humidity") && agg.relativeHumidityPct !== void 0) {
|
|
744
|
+
out.relativeHumidityPct = agg.relativeHumidityPct;
|
|
745
|
+
}
|
|
746
|
+
return out;
|
|
747
|
+
}
|
|
748
|
+
function formatStatus(lastSuccessAt, queue) {
|
|
749
|
+
if (!lastSuccessAt) {
|
|
750
|
+
return queue > 0 ? `Awaiting first successful send \u2022 queue: ${queue}` : "Awaiting first submission";
|
|
751
|
+
}
|
|
752
|
+
const minsAgo = Math.max(
|
|
753
|
+
0,
|
|
754
|
+
Math.round((Date.now() - Date.parse(lastSuccessAt)) / 6e4)
|
|
755
|
+
);
|
|
756
|
+
return `Last sent ${minsAgo} min ago \u2022 queue: ${queue}`;
|
|
757
|
+
}
|
|
758
|
+
module.exports = pluginFactory;
|
|
759
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../node_modules/.pnpm/sailorwind-integration-core@file+..+shared/node_modules/sailorwind-integration-core/src/units.ts", "../node_modules/.pnpm/sailorwind-integration-core@file+..+shared/node_modules/sailorwind-integration-core/src/aggregator.ts", "../node_modules/.pnpm/sailorwind-integration-core@file+..+shared/node_modules/sailorwind-integration-core/src/submitter.ts", "../node_modules/.pnpm/sailorwind-integration-core@file+..+shared/node_modules/sailorwind-integration-core/src/queue/fs-queue-store.ts", "../src/index.ts"],
|
|
4
|
+
"sourcesContent": [null, null, null, null, "// SignalK plugin entrypoint.\n//\n// SK server contract reminder: this module's default export is a *factory*\n// that takes the host `app` and returns the plugin object with id / name /\n// description / schema / start / stop / statusMessage. Because the SK admin\n// loader does a CommonJS `require()` and accesses the result directly, we\n// compile to CJS and use `export =` (TypeScript's CJS-interop) below.\n//\n// Caveats embedded as comments because they bite future maintainers:\n// - True wind direction (TWD) is degrees TRUE here, NOT magnetic. SignalK\n// exposes both `directionTrue` and `directionMagnetic`; we subscribe to\n// `directionTrue` and never auto-convert magnetic\u2192true (no reliable\n// variation source in v1).\n// - SignalK pressure is Pa; sailorwind wants hPa. Conversion is /100.\n// - SignalK humidity is a 0..1 ratio; sailorwind wants %. Conversion is *100.\n// - Wind direction convention is meteorological \u2014 direction wind is FROM.\n// - Wave height/period/direction are intentionally not subscribed in v1\n// (deferred until we have gyro-corrected processing).\n// - Gust is derived as max(speedMs) over the window; no separate SK path.\n\nimport {\n Aggregator,\n Submitter,\n type ObservationInput,\n} from \"sailorwind-integration-core\";\n// FsQueueStore lives behind its own subpath export so the lib's root barrel\n// stays browser-safe (no node:fs imports leak into apps/web's Vite bundle).\nimport { FsQueueStore } from \"sailorwind-integration-core/fs-queue-store\";\nimport type {\n PluginOptions,\n SignalKApp,\n SignalKBusValue,\n SignalKDelta,\n SubmittableField,\n} from \"./types.js\";\n\nconst PLUGIN_ID = \"sailorwind\";\nconst PLUGIN_NAME = \"sailorwind weather submission\";\n// Source-of-truth default for the API base URL. Used both as the schema\n// `default` (what the admin UI shows in the empty field on first install)\n// AND as the runtime fallback in start() (because SK's schema validator\n// does NOT auto-apply JSON-schema defaults to saved config \u2014 a user who\n// blanks the field gets options.serverUrl === \"\", not the default). Keep\n// the two sites in sync via this constant.\nconst DEFAULT_SERVER_URL = \"https://sailorwind.net\";\nconst SUBMIT_INTERVAL_MS = 10 * 60 * 1000; // 10 minutes \u2014 not user-configurable in v1.\n// Short delay before the FIRST submission so the aggregator has time to gather\n// at least one position + a few wind samples. Without this, setInterval waits\n// the full 10 minutes before the leading-edge POST, which delays both\n// verification UX and the first real obs of any leg by 10 minutes.\nconst FIRST_SUBMISSION_DELAY_MS = 60 * 1000;\n\n// SignalK paths we may subscribe to, keyed by sailorwind config field.\nconst PATHS = {\n position: \"navigation.position\",\n windDirection: \"environment.wind.directionTrue\",\n windSpeed: \"environment.wind.speedTrue\",\n pressure: \"environment.outside.pressure\",\n airTemp: \"environment.outside.temperature\",\n waterTemp: \"environment.water.temperature\",\n humidity: \"environment.outside.humidity\",\n} as const;\n\ninterface PluginInstance {\n id: string;\n name: string;\n description: string;\n schema: object;\n uiSchema?: object;\n start: (options: PluginOptions) => void;\n stop: () => void;\n statusMessage: () => string;\n}\n\nfunction pluginFactory(app: SignalKApp): PluginInstance {\n let aggregator: Aggregator | null = null;\n let submitter: Submitter | null = null;\n let intervalHandle: NodeJS.Timeout | null = null;\n let firstSubmissionHandle: NodeJS.Timeout | null = null;\n let unsubscribers: Array<() => void> = [];\n let deltaHandler: ((delta: SignalKDelta) => void) | null = null;\n let enabledFields: Set<SubmittableField> = new Set();\n let warnedMagneticOnly = false;\n let status = \"Not started\";\n\n function start(options: PluginOptions): void {\n if (!options || typeof options.apiToken !== \"string\" || options.apiToken === \"\") {\n app.error(\n \"apiToken is required \u2014 get one from the Settings gear in the sailorwind web app\",\n );\n status = \"Misconfigured: missing apiToken\";\n return;\n }\n // SK does NOT apply schema defaults to saved config (blanked field \u2192\n // empty string in options), so honor the schema's advertised default\n // here. Only an explicitly typo'd non-string would reach the guard.\n const serverUrl = options.serverUrl || DEFAULT_SERVER_URL;\n if (typeof serverUrl !== \"string\") {\n app.error(\"serverUrl must be a string\");\n status = \"Misconfigured: invalid serverUrl\";\n return;\n }\n\n enabledFields = new Set(options.fields ?? []);\n aggregator = new Aggregator();\n // FsQueueStore persists `${dataDirPath}/queue.json` \u2014 same on-disk layout\n // the plugin used before the shared-lib extraction, so existing installs\n // pick up their queued obs transparently after upgrade.\n const queueStore = new FsQueueStore({\n dataDirPath: app.getDataDirPath(),\n debug: (m) => app.debug(m),\n error: (m) => app.error(m),\n });\n submitter = new Submitter({\n serverUrl,\n apiToken: options.apiToken,\n queueStore,\n debug: (m) => app.debug(m),\n error: (m) => app.error(m),\n });\n\n // Best-effort preload of the persisted queue; we don't await because\n // start() is synchronous in the SK contract.\n submitter.load().catch((err) => app.error(`queue load: ${String(err)}`));\n\n subscribe(app, enabledFields, {\n onPosition: (lat, lon, t) => aggregator?.addPosition(lat, lon, t),\n onWindSpeed: (v, t) => aggregator?.addWindSpeed(v, t),\n onWindDirTrue: (v, t) => aggregator?.addWindDirection(v, t),\n onWindDirMagneticOnly: () => {\n // Boats that only publish directionMagnetic get one warning per\n // start() and then we silently skip their wind direction. Without\n // a reliable variation source we can't convert mag\u2192true.\n if (!warnedMagneticOnly) {\n warnedMagneticOnly = true;\n app.error(\n \"wind direction is published as magnetic only; sailorwind needs degrees TRUE \u2014 skipping wind dir for this vessel until directionTrue is available\",\n );\n }\n },\n onPressure: (v, t) => aggregator?.addPressure(v, t),\n onAirTemp: (v, t) => aggregator?.addAirTemp(v, t),\n onWaterTemp: (v, t) => aggregator?.addWaterTemp(v, t),\n onHumidity: (v, t) => aggregator?.addHumidity(v, t),\n }).then(\n ({ unsubscribe, delta }) => {\n unsubscribers = unsubscribe;\n deltaHandler = delta;\n },\n (err) => app.error(`subscribe failed: ${String(err)}`),\n );\n\n // Leading-edge submission ~60s after start to confirm the path is healthy\n // and to get a first real obs onto the map within a minute of plugin\n // boot \u2014 then settle into the steady 10-min cadence.\n firstSubmissionHandle = setTimeout(() => {\n firstSubmissionHandle = null;\n void submit();\n intervalHandle = setInterval(() => {\n void submit();\n }, SUBMIT_INTERVAL_MS);\n }, FIRST_SUBMISSION_DELAY_MS);\n status = \"Awaiting first submission\";\n app.debug(\n `started; first submission in ${FIRST_SUBMISSION_DELAY_MS}ms, then every ${SUBMIT_INTERVAL_MS}ms`,\n );\n }\n\n async function submit(): Promise<void> {\n if (!aggregator || !submitter) return;\n if (aggregator.isEmpty()) {\n app.debug(\"window had no position \u2014 skipping submission\");\n // Still drain any leftover queue from a previous failed window.\n const drainState = await submitter.drain();\n status = formatStatus(drainState.lastSuccessAt, drainState.queueDepth);\n return;\n }\n const agg = aggregator.flush();\n aggregator.reset();\n if (!agg) return;\n\n const body = buildObservation(agg, enabledFields);\n await submitter.enqueue(body);\n const drainState = await submitter.drain();\n status = formatStatus(drainState.lastSuccessAt, drainState.queueDepth);\n }\n\n function stop(): void {\n if (firstSubmissionHandle) {\n clearTimeout(firstSubmissionHandle);\n firstSubmissionHandle = null;\n }\n if (intervalHandle) {\n clearInterval(intervalHandle);\n intervalHandle = null;\n }\n for (const u of unsubscribers) {\n try {\n u();\n } catch (err) {\n app.debug(`unsubscribe error: ${String(err)}`);\n }\n }\n unsubscribers = [];\n if (deltaHandler && app.signalk) {\n app.signalk.removeListener(\"delta\", deltaHandler);\n deltaHandler = null;\n }\n aggregator = null;\n submitter = null;\n status = \"Stopped\";\n app.debug(\"stopped\");\n }\n\n function statusMessage(): string {\n return status;\n }\n\n return {\n id: PLUGIN_ID,\n name: PLUGIN_NAME,\n description: \"Pushes weather observations to sailorwind.net\",\n schema: {\n type: \"object\",\n required: [\"serverUrl\", \"apiToken\"],\n properties: {\n serverUrl: {\n type: \"string\",\n default: DEFAULT_SERVER_URL,\n title: \"sailorwind API base URL\",\n },\n apiToken: {\n type: \"string\",\n title: \"Device token (slw_dev_...)\",\n description:\n \"Treat as a secret. Generate it by opening https://sailorwind.net, signing in, and clicking the gear icon (Settings) in the user menu.\",\n },\n fields: {\n type: \"array\",\n title: \"Fields to submit (position is always included)\",\n items: {\n type: \"string\",\n enum: [\n \"windSpeed\",\n \"windDirection\",\n \"pressure\",\n \"airTemp\",\n \"waterTemp\",\n \"humidity\",\n ],\n },\n uniqueItems: true,\n default: [\"windSpeed\", \"windDirection\"],\n },\n },\n },\n // Newer SK admin UIs honour uiSchema for widget hints. Older ones ignore it.\n uiSchema: {\n apiToken: { \"ui:widget\": \"password\" },\n },\n start,\n stop,\n statusMessage,\n };\n}\n\n// \u2500\u2500 SignalK subscription plumbing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ninterface SubscribeCallbacks {\n onPosition: (lat: number, lon: number, t: number) => void;\n onWindSpeed: (v: number, t: number) => void;\n onWindDirTrue: (v: number, t: number) => void;\n onWindDirMagneticOnly: () => void;\n onPressure: (v: number, t: number) => void;\n onAirTemp: (v: number, t: number) => void;\n onWaterTemp: (v: number, t: number) => void;\n onHumidity: (v: number, t: number) => void;\n}\n\ninterface SubscribeResult {\n unsubscribe: Array<() => void>;\n delta: ((delta: SignalKDelta) => void) | null;\n}\n\n/**\n * Wire up self-vessel subscriptions for every enabled field.\n *\n * Preference order:\n * 1) streamBundle.getSelfBus(path) \u2014 modern SK, gives us per-path streams\n * filtered to the self vessel automatically.\n * 2) signalk.on('delta', ...) \u2014 legacy fallback. We filter to the self\n * vessel by checking `context` against `app.selfContext`.\n *\n * The \"magnetic-only\" warning is intentionally NOT triggered here \u2014 we don't\n * have a reliable way to know a value is \"magnetic only\" from a single delta.\n * It's a future enhancement; the callback exists so the wiring is ready.\n */\nasync function subscribe(\n app: SignalKApp,\n fields: Set<SubmittableField>,\n cb: SubscribeCallbacks,\n): Promise<SubscribeResult> {\n const unsubscribe: Array<() => void> = [];\n // Build the list of paths we actually want.\n const wantPaths: Array<{ path: string; kind: keyof typeof PATHS }> = [\n { path: PATHS.position, kind: \"position\" }, // always\n ];\n if (fields.has(\"windSpeed\")) {\n wantPaths.push({ path: PATHS.windSpeed, kind: \"windSpeed\" });\n }\n if (fields.has(\"windDirection\")) {\n wantPaths.push({ path: PATHS.windDirection, kind: \"windDirection\" });\n }\n if (fields.has(\"pressure\")) {\n wantPaths.push({ path: PATHS.pressure, kind: \"pressure\" });\n }\n if (fields.has(\"airTemp\")) {\n wantPaths.push({ path: PATHS.airTemp, kind: \"airTemp\" });\n }\n if (fields.has(\"waterTemp\")) {\n wantPaths.push({ path: PATHS.waterTemp, kind: \"waterTemp\" });\n }\n if (fields.has(\"humidity\")) {\n wantPaths.push({ path: PATHS.humidity, kind: \"humidity\" });\n }\n\n if (app.streamBundle?.getSelfBus) {\n for (const { path, kind } of wantPaths) {\n const bus = app.streamBundle.getSelfBus(path);\n const off = bus.onValue((v: SignalKBusValue) => {\n handlePathValue(kind, v.value, parseTs(v.timestamp), cb);\n });\n unsubscribe.push(off);\n }\n return { unsubscribe, delta: null };\n }\n\n // Fallback: legacy 'delta' event. Filter to self vessel.\n if (app.signalk?.on) {\n const wantSet = new Set(wantPaths.map((p) => p.path));\n const handler = (d: SignalKDelta): void => {\n if (d.context && app.selfContext && d.context !== app.selfContext) {\n return;\n }\n for (const update of d.updates ?? []) {\n const ts = parseTs(update.timestamp);\n for (const v of update.values ?? []) {\n if (!wantSet.has(v.path)) continue;\n const kind = pathToKind(v.path);\n if (kind) handlePathValue(kind, v.value, ts, cb);\n }\n }\n };\n app.signalk.on(\"delta\", handler);\n return { unsubscribe, delta: handler };\n }\n\n app.error(\n \"neither streamBundle.getSelfBus nor signalk.on('delta') is available \u2014 plugin cannot receive data\",\n );\n return { unsubscribe, delta: null };\n}\n\nfunction pathToKind(p: string): keyof typeof PATHS | null {\n for (const [k, v] of Object.entries(PATHS)) {\n if (v === p) return k as keyof typeof PATHS;\n }\n return null;\n}\n\nfunction handlePathValue(\n kind: keyof typeof PATHS,\n value: unknown,\n t: number,\n cb: SubscribeCallbacks,\n): void {\n if (kind === \"position\") {\n // SignalK encodes position as { latitude, longitude, altitude? }.\n if (typeof value === \"object\" && value !== null) {\n const v = value as { latitude?: unknown; longitude?: unknown };\n if (typeof v.latitude === \"number\" && typeof v.longitude === \"number\") {\n cb.onPosition(v.latitude, v.longitude, t);\n }\n }\n return;\n }\n if (typeof value !== \"number\" || !Number.isFinite(value)) return;\n switch (kind) {\n case \"windSpeed\":\n cb.onWindSpeed(value, t);\n break;\n case \"windDirection\":\n cb.onWindDirTrue(value, t);\n break;\n case \"pressure\":\n cb.onPressure(value, t);\n break;\n case \"airTemp\":\n cb.onAirTemp(value, t);\n break;\n case \"waterTemp\":\n cb.onWaterTemp(value, t);\n break;\n case \"humidity\":\n cb.onHumidity(value, t);\n break;\n }\n}\n\nfunction parseTs(s: string | undefined): number {\n if (!s) return Date.now();\n const ms = Date.parse(s);\n return Number.isFinite(ms) ? ms : Date.now();\n}\n\n// \u2500\u2500 Output assembly \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Convert the aggregator's output into the wire body, applying the user's\n * field selection. Position is always included; everything else is gated.\n *\n * Not exported \u2014 `export =` (CJS interop) forbids sibling exports. The\n * function is pure and small enough that pulling it back out for direct\n * testing would mean a refactor; for now it's covered transitively by the\n * aggregator tests + future end-to-end hand testing.\n */\nfunction buildObservation(\n agg: {\n observedAt: string;\n latDeg: number;\n lonDeg: number;\n windSpeedMs?: number;\n windGustMs?: number;\n windFromDeg?: number;\n pressureHpa?: number;\n airTempC?: number;\n sstC?: number;\n relativeHumidityPct?: number;\n windGust10sMs?: number;\n windGust30sMs?: number;\n windGust60sMs?: number;\n windSpeedStdMs?: number;\n windGustCrossings?: number;\n windSpeedHistogram?: number[];\n },\n fields: Set<SubmittableField>,\n): ObservationInput {\n const out: ObservationInput = {\n observedAt: agg.observedAt,\n position: { lat: agg.latDeg, lon: agg.lonDeg },\n positionSource: \"gps\",\n source: \"auto_signalk\",\n };\n if (fields.has(\"windSpeed\")) {\n if (agg.windSpeedMs !== undefined) out.windSpeedMs = agg.windSpeedMs;\n if (agg.windGustMs !== undefined) out.windGustMs = agg.windGustMs;\n // Rich distribution rides the windSpeed opt-in (all derived from speed).\n if (agg.windGust10sMs !== undefined) out.windGust10sMs = agg.windGust10sMs;\n if (agg.windGust30sMs !== undefined) out.windGust30sMs = agg.windGust30sMs;\n if (agg.windGust60sMs !== undefined) out.windGust60sMs = agg.windGust60sMs;\n if (agg.windSpeedStdMs !== undefined) out.windSpeedStdMs = agg.windSpeedStdMs;\n if (agg.windGustCrossings !== undefined)\n out.windGustCrossings = agg.windGustCrossings;\n if (agg.windSpeedHistogram !== undefined)\n out.windSpeedHistogram = agg.windSpeedHistogram;\n }\n if (fields.has(\"windDirection\") && agg.windFromDeg !== undefined) {\n out.windDirDegFrom = agg.windFromDeg;\n }\n if (fields.has(\"pressure\") && agg.pressureHpa !== undefined) {\n out.pressureHpa = agg.pressureHpa;\n }\n if (fields.has(\"airTemp\") && agg.airTempC !== undefined) {\n out.airTempC = agg.airTempC;\n }\n if (fields.has(\"waterTemp\") && agg.sstC !== undefined) {\n out.sstC = agg.sstC;\n }\n if (fields.has(\"humidity\") && agg.relativeHumidityPct !== undefined) {\n out.relativeHumidityPct = agg.relativeHumidityPct;\n }\n return out;\n}\n\n// \u2500\u2500 Status string \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction formatStatus(lastSuccessAt: string | undefined, queue: number): string {\n if (!lastSuccessAt) {\n return queue > 0\n ? `Awaiting first successful send \u2022 queue: ${queue}`\n : \"Awaiting first submission\";\n }\n const minsAgo = Math.max(\n 0,\n Math.round((Date.now() - Date.parse(lastSuccessAt)) / 60000),\n );\n return `Last sent ${minsAgo} min ago \u2022 queue: ${queue}`;\n}\n\n// CommonJS export \u2014 SK server admin loader does `require('signalk-sailorwind-plugin')(app)`.\nexport = pluginFactory;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAkBM,SAAU,SAAS,KAAW;AAClC,QAAM,MAAO,MAAM,MAAO,KAAK;AAC/B,SAAO,QAAQ,GAAG;AACpB;AAQM,SAAU,QAAQ,KAAW;AACjC,QAAM,UAAU,MAAM;AACtB,SAAO,UAAU,IAAI,UAAU,MAAM;AACvC;AAGM,SAAU,gBAAgB,GAAS;AACvC,SAAO,IAAI;AACb;AAGM,SAAU,QAAQ,IAAU;AAChC,SAAO,KAAK;AACd;AAGM,SAAU,e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AAC,eAAe;AAClB,WAAO,QAAQ,IACX,gDAA2C,KAAK,KAChD;AAAA,EACN;AACA,QAAM,UAAU,KAAK;AAAA,IACnB;AAAA,IACA,KAAK,OAAO,KAAK,IAAI,IAAI,KAAK,MAAM,aAAa,KAAK,GAAK;AAAA,EAC7D;AACA,SAAO,aAAa,OAAO,0BAAqB,KAAK;AACvD;AAGA,iBAAS;",
|
|
6
|
+
"names": ["uuidv4", "path", "fs", "drainState", "path"]
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "signalk-sailorwind-plugin",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "SignalK server plugin that pushes weather observations to sailorwind.net",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"README.md",
|
|
9
|
+
"LICENSE"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "node build.mjs",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest",
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"prepublishOnly": "pnpm build"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"signalk-node-server-plugin",
|
|
20
|
+
"signalk-category-weather",
|
|
21
|
+
"sailorwind",
|
|
22
|
+
"marine",
|
|
23
|
+
"weather",
|
|
24
|
+
"observations"
|
|
25
|
+
],
|
|
26
|
+
"author": "Adam Backer <admin@sailorwind.net>",
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"homepage": "https://sailorwind.net",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"email": "admin@sailorwind.net"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"uuid": "^11.0.5"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"sailorwind-integration-core": "file:../shared",
|
|
40
|
+
"@types/node": "^22.10.0",
|
|
41
|
+
"@types/uuid": "^10.0.0",
|
|
42
|
+
"esbuild": "^0.24.0",
|
|
43
|
+
"typescript": "^5.7.2",
|
|
44
|
+
"vitest": "^2.1.8"
|
|
45
|
+
}
|
|
46
|
+
}
|