@azohra/meteo.station 0.1.1 → 0.1.3
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/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +2 -1
- package/dist/client/live.d.ts +37 -0
- package/dist/client/live.js +241 -0
- package/dist/client/stores.d.ts +1 -0
- package/dist/client/stores.js +41 -6
- package/dist/contract.d.ts +237 -1
- package/dist/contract.js +57 -3
- package/dist/endpoints.d.ts +2 -1
- package/dist/endpoints.js +4 -1
- package/dist/geometry.d.ts +4 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +5 -4
- package/dist/react/hooks/useStation.d.ts +1 -0
- package/dist/react/hooks/useStation.js +25 -5
- package/dist/react/hooks/useStationLive.d.ts +20 -0
- package/dist/react/hooks/useStationLive.js +33 -0
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/samples.d.ts +20 -0
- package/dist/samples.js +88 -0
- package/dist/server/adapter.d.ts +3 -1
- package/dist/server/adapter.js +3 -1
- package/dist/server/adapters/windnerd-live.d.ts +21 -0
- package/dist/server/adapters/windnerd-live.js +179 -0
- package/dist/server/adapters/windnerd.d.ts +36 -5
- package/dist/server/adapters/windnerd.js +177 -15
- package/dist/server/config.d.ts +2 -0
- package/dist/server/config.js +2 -1
- package/dist/server/environment.d.ts +25 -5
- package/dist/server/environment.js +65 -21
- package/dist/server/feed.d.ts +20 -2
- package/dist/server/feed.js +28 -1
- package/dist/server/handler.d.ts +1 -1
- package/dist/server/handler.js +37 -3
- package/dist/server/index.d.ts +6 -4
- package/dist/server/index.js +6 -4
- package/dist/server/live.d.ts +15 -0
- package/dist/server/live.js +19 -0
- package/dist/sse.js +56 -0
- package/package.json +1 -1
- package/schema/README.md +1 -1
- package/schema/example-feed.json +26 -1
- package/schema/example-live.json +74 -0
- package/schema/stationcurrent.schema.json +115 -0
- package/schema/stationfeed.schema.json +115 -0
- package/schema/stationlive.schema.json +868 -0
package/dist/server/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { normalizeWindnerdStationKey, windnerdStationUrl } from "../windnerd.js";
|
|
2
|
-
import { DEFAULT_USER_AGENT, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError, boundedResponseText, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError } from "./environment.js";
|
|
2
|
+
import { DEFAULT_USER_AGENT, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UpstreamError, boundedResponseText, coalesceUpstreamLoad, fetchUpstreamStream, fetchUpstreamText, logUpstreamFailure, memoryCache, resolveEnvironment, unavailableReasonForError } from "./environment.js";
|
|
3
3
|
import { campbellStationConfigSchema, customStationConfigSchema, parseStationConfig, stationConfigSchema, tempestStationConfigSchema, windnerdStationConfigSchema } from "./config.js";
|
|
4
4
|
import { CAMPBELL_FIELD_CONTRACTS, loadCampbellCurrent, loadCampbellStation, naiveLocalToIso, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable } from "./adapters/campbell.js";
|
|
5
5
|
import { loadTempestStation, parseTempestWind } from "./adapters/tempest.js";
|
|
6
|
-
import { loadWindnerdStation, parseWindnerdRecords, windnerdHistoryPoints } from "./adapters/windnerd.js";
|
|
7
|
-
import {
|
|
6
|
+
import { WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, loadWindnerdStation, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl } from "./adapters/windnerd.js";
|
|
7
|
+
import { openWindnerdLive } from "./adapters/windnerd-live.js";
|
|
8
|
+
import { DEFAULT_HISTORY_HOURS, StationLiveUnsupportedError, UnknownStationError, assembleStations, loadStationCurrent, loadStationFeed, openStationLive } from "./feed.js";
|
|
8
9
|
import { defineStationAdapter } from "./adapter.js";
|
|
10
|
+
import { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse } from "./live.js";
|
|
9
11
|
import { createStationFeedHandler } from "./handler.js";
|
|
10
|
-
export { CAMPBELL_FIELD_CONTRACTS, DEFAULT_HISTORY_HOURS, DEFAULT_USER_AGENT, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UnknownStationError, UpstreamError, assembleStations, boundedResponseText, campbellStationConfigSchema, createStationFeedHandler, customStationConfigSchema, defineStationAdapter, fetchUpstreamText, loadCampbellCurrent, loadCampbellStation, loadStationCurrent, loadStationFeed, loadTempestStation, loadWindnerdStation, logUpstreamFailure, memoryCache, naiveLocalToIso, normalizeWindnerdStationKey, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable, parseStationConfig, parseTempestWind, parseWindnerdRecords, resolveEnvironment, stationConfigSchema, tempestStationConfigSchema, unavailableReasonForError, windnerdHistoryPoints, windnerdStationConfigSchema, windnerdStationUrl };
|
|
12
|
+
export { CAMPBELL_FIELD_CONTRACTS, DEFAULT_HISTORY_HOURS, DEFAULT_USER_AGENT, STATION_LIVE_SSE_HEADERS, StationLiveUnsupportedError, UPSTREAM_CONNECT_TIMEOUT_MS, UPSTREAM_FAILURE_REASONS, UPSTREAM_FETCH_TIMEOUT_MS, UPSTREAM_RESPONSE_LIMIT_BYTES, UnknownStationError, UpstreamError, WINDNERD_LIVE_SAMPLE_INTERVAL_SECONDS, assembleStations, boundedResponseText, campbellStationConfigSchema, coalesceUpstreamLoad, createStationFeedHandler, customStationConfigSchema, defineStationAdapter, encodeStationLiveSse, fetchUpstreamStream, fetchUpstreamText, loadCampbellCurrent, loadCampbellStation, loadStationCurrent, loadStationFeed, loadTempestStation, loadWindnerdStation, logUpstreamFailure, memoryCache, naiveLocalToIso, normalizeWindnerdStationKey, openStationLive, openWindnerdLive, parseCampbellCurrent, parseCampbellHistory, parseCampbellTable, parseStationConfig, parseTempestWind, parseWindnerdLiveDigest, parseWindnerdLiveInit, parseWindnerdLiveSampleRecords, parseWindnerdRecords, resolveEnvironment, stationConfigSchema, tempestStationConfigSchema, unavailableReasonForError, windnerdHistoryPoints, windnerdLiveReading, windnerdLiveSamples, windnerdLiveStreamUrl, windnerdStationConfigSchema, windnerdStationUrl };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StationLiveFrame } from "../contract.js";
|
|
2
|
+
//#region src/server/live.d.ts
|
|
3
|
+
declare const STATION_LIVE_SSE_HEADERS: {
|
|
4
|
+
readonly "Content-Type": "text/event-stream; charset=utf-8";
|
|
5
|
+
readonly "Cache-Control": "no-cache, no-store";
|
|
6
|
+
readonly "X-Accel-Buffering": "no";
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Encodes live frames as SSE bytes, one data event per frame. This plus a
|
|
10
|
+
* vendor open call (openWindnerdLive) is the seam a host uses to serve live
|
|
11
|
+
* data through its own route or fan-out infrastructure.
|
|
12
|
+
*/
|
|
13
|
+
declare function encodeStationLiveSse(frames: ReadableStream<StationLiveFrame>): ReadableStream<Uint8Array>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/server/live.ts
|
|
2
|
+
const STATION_LIVE_SSE_HEADERS = {
|
|
3
|
+
"Content-Type": "text/event-stream; charset=utf-8",
|
|
4
|
+
"Cache-Control": "no-cache, no-store",
|
|
5
|
+
"X-Accel-Buffering": "no"
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Encodes live frames as SSE bytes, one data event per frame. This plus a
|
|
9
|
+
* vendor open call (openWindnerdLive) is the seam a host uses to serve live
|
|
10
|
+
* data through its own route or fan-out infrastructure.
|
|
11
|
+
*/
|
|
12
|
+
function encodeStationLiveSse(frames) {
|
|
13
|
+
const encoder = new TextEncoder();
|
|
14
|
+
return frames.pipeThrough(new TransformStream({ transform(frame, controller) {
|
|
15
|
+
controller.enqueue(encoder.encode(`data: ${JSON.stringify(frame)}\n\n`));
|
|
16
|
+
} }));
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { STATION_LIVE_SSE_HEADERS, encodeStationLiveSse };
|
package/dist/sse.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/sse.ts
|
|
2
|
+
const DEFAULT_MAX_EVENT_BYTES = 262144;
|
|
3
|
+
async function* sseEvents(body, options = {}) {
|
|
4
|
+
const maxEventBytes = options.maxEventBytes ?? 262144;
|
|
5
|
+
const reader = body.getReader();
|
|
6
|
+
const decoder = new TextDecoder();
|
|
7
|
+
let buffered = "";
|
|
8
|
+
let dataLines = [];
|
|
9
|
+
let eventName = "";
|
|
10
|
+
let eventBytes = 0;
|
|
11
|
+
const abortError = () => new DOMException("SSE read aborted", "AbortError");
|
|
12
|
+
const aborted = options.signal ? new Promise((_resolve, reject) => {
|
|
13
|
+
if (options.signal?.aborted) reject(abortError());
|
|
14
|
+
options.signal?.addEventListener("abort", () => reject(abortError()), { once: true });
|
|
15
|
+
}) : null;
|
|
16
|
+
aborted?.catch(() => void 0);
|
|
17
|
+
const fieldValue = (line, colon) => {
|
|
18
|
+
const value = line.slice(colon + 1);
|
|
19
|
+
return value.startsWith(" ") ? value.slice(1) : value;
|
|
20
|
+
};
|
|
21
|
+
try {
|
|
22
|
+
while (true) {
|
|
23
|
+
const { done, value } = aborted ? await Promise.race([reader.read(), aborted]) : await reader.read();
|
|
24
|
+
buffered += decoder.decode(value ?? /* @__PURE__ */ new Uint8Array(), { stream: !done });
|
|
25
|
+
let newline = buffered.indexOf("\n");
|
|
26
|
+
while (newline !== -1) {
|
|
27
|
+
let line = buffered.slice(0, newline);
|
|
28
|
+
buffered = buffered.slice(newline + 1);
|
|
29
|
+
if (line.endsWith("\r")) line = line.slice(0, -1);
|
|
30
|
+
if (line === "") {
|
|
31
|
+
if (dataLines.length > 0) yield {
|
|
32
|
+
event: eventName === "" ? "message" : eventName,
|
|
33
|
+
data: dataLines.join("\n")
|
|
34
|
+
};
|
|
35
|
+
dataLines = [];
|
|
36
|
+
eventName = "";
|
|
37
|
+
eventBytes = 0;
|
|
38
|
+
} else if (!line.startsWith(":")) {
|
|
39
|
+
eventBytes += line.length;
|
|
40
|
+
if (eventBytes > maxEventBytes) throw new Error(`SSE event exceeded ${maxEventBytes} bytes`);
|
|
41
|
+
const colon = line.indexOf(":");
|
|
42
|
+
const field = colon === -1 ? line : line.slice(0, colon);
|
|
43
|
+
if (field === "data") dataLines.push(colon === -1 ? "" : fieldValue(line, colon));
|
|
44
|
+
else if (field === "event") eventName = colon === -1 ? "" : fieldValue(line, colon);
|
|
45
|
+
}
|
|
46
|
+
newline = buffered.indexOf("\n");
|
|
47
|
+
}
|
|
48
|
+
if (buffered.length > maxEventBytes) throw new Error(`SSE event exceeded ${maxEventBytes} bytes`);
|
|
49
|
+
if (done) return;
|
|
50
|
+
}
|
|
51
|
+
} finally {
|
|
52
|
+
await reader.cancel().catch(() => void 0);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { DEFAULT_MAX_EVENT_BYTES, sseEvents };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azohra/meteo.station",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "The station capability of meteo by Azohra: live weather-station reading, derivation, and display - the wire contract, provider adapters, a polling client, a Node server, and React and custom-element display bindings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"weather-station",
|
package/schema/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Wire contract artifacts
|
|
2
2
|
|
|
3
3
|
The station capability's wire contract in language-neutral form: JSON
|
|
4
|
-
Schemas emitted from the zod contract (`station/contract.ts`), plus
|
|
4
|
+
Schemas emitted from the zod contract (`station/contract.ts`), plus three
|
|
5
5
|
annotated example documents. Never edited by hand — regenerate with
|
|
6
6
|
`pnpm schemas` at the workspace root, which must reproduce every file
|
|
7
7
|
byte-identical (the drift guard is this package's own test suite).
|
package/schema/example-feed.json
CHANGED
|
@@ -60,7 +60,9 @@
|
|
|
60
60
|
"gustLull": true,
|
|
61
61
|
"temperature": true,
|
|
62
62
|
"conditions": true,
|
|
63
|
-
"history": true
|
|
63
|
+
"history": true,
|
|
64
|
+
"live": true,
|
|
65
|
+
"battery": true
|
|
64
66
|
},
|
|
65
67
|
"samplingWindowSeconds": 60,
|
|
66
68
|
"recommendedPollSeconds": 60,
|
|
@@ -119,6 +121,29 @@
|
|
|
119
121
|
"seaLevelPressureHpa": 1006.1
|
|
120
122
|
}
|
|
121
123
|
]
|
|
124
|
+
},
|
|
125
|
+
"telemetry": {
|
|
126
|
+
"batteryVoltage": 4.15
|
|
127
|
+
},
|
|
128
|
+
"samples": {
|
|
129
|
+
"intervalSeconds": 3,
|
|
130
|
+
"points": [
|
|
131
|
+
{
|
|
132
|
+
"observedAt": "2026-08-05T22:12:39.000Z",
|
|
133
|
+
"windMps": 2.2,
|
|
134
|
+
"windDirectionDeg": 288
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"observedAt": "2026-08-05T22:12:42.000Z",
|
|
138
|
+
"windMps": 2.7,
|
|
139
|
+
"windDirectionDeg": 291
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"observedAt": "2026-08-05T22:12:45.000Z",
|
|
143
|
+
"windMps": 0.3,
|
|
144
|
+
"windDirectionDeg": null
|
|
145
|
+
}
|
|
146
|
+
]
|
|
122
147
|
}
|
|
123
148
|
},
|
|
124
149
|
{
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Example @azohra/meteo.station live frame — the init frame that opens every /live stream. Each SSE data event validates against stationlive.schema.json; readers must ignore unknown keys (this one included).",
|
|
3
|
+
"type": "init",
|
|
4
|
+
"schemaVersion": 2,
|
|
5
|
+
"servedAt": "2026-08-05T22:13:00.000Z",
|
|
6
|
+
"station": {
|
|
7
|
+
"id": "bluff",
|
|
8
|
+
"name": "Bluff Launch",
|
|
9
|
+
"sourceLabel": "WindNerd",
|
|
10
|
+
"pageUrl": "https://example.com/stations/bluff-launch",
|
|
11
|
+
"latitude": 49.7,
|
|
12
|
+
"longitude": -118.2,
|
|
13
|
+
"timeZone": "America/Vancouver",
|
|
14
|
+
"elevationM": 1370,
|
|
15
|
+
"capabilities": {
|
|
16
|
+
"gustLull": true,
|
|
17
|
+
"temperature": true,
|
|
18
|
+
"conditions": true,
|
|
19
|
+
"history": true,
|
|
20
|
+
"live": true,
|
|
21
|
+
"battery": true
|
|
22
|
+
},
|
|
23
|
+
"samplingWindowSeconds": 60,
|
|
24
|
+
"recommendedPollSeconds": 60,
|
|
25
|
+
"status": "ok",
|
|
26
|
+
"reading": {
|
|
27
|
+
"observedAt": "2026-08-05T22:12:45.000Z",
|
|
28
|
+
"windAvgMps": 2.5,
|
|
29
|
+
"windDirectionDeg": 290,
|
|
30
|
+
"windGustMps": 3.9,
|
|
31
|
+
"windLullMps": 1.7,
|
|
32
|
+
"temperatureC": 22.6,
|
|
33
|
+
"windChillC": null,
|
|
34
|
+
"conditions": {
|
|
35
|
+
"dewPointC": null,
|
|
36
|
+
"lastLightningStrikeAt": null,
|
|
37
|
+
"lastLightningStrikeDistanceKm": null,
|
|
38
|
+
"lightningStrikeCountLastHour": null,
|
|
39
|
+
"precipitationMinutesToday": null,
|
|
40
|
+
"precipitationRateMmPerHour": null,
|
|
41
|
+
"precipitationTodayMm": null,
|
|
42
|
+
"pressureTrend": "steady",
|
|
43
|
+
"relativeHumidityPercent": null,
|
|
44
|
+
"seaLevelPressureHpa": 1006.1,
|
|
45
|
+
"solarRadiationWm2": null,
|
|
46
|
+
"uvIndex": null
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"history": null,
|
|
50
|
+
"telemetry": {
|
|
51
|
+
"batteryVoltage": 4.15
|
|
52
|
+
},
|
|
53
|
+
"samples": {
|
|
54
|
+
"intervalSeconds": 3,
|
|
55
|
+
"points": [
|
|
56
|
+
{
|
|
57
|
+
"observedAt": "2026-08-05T22:12:39.000Z",
|
|
58
|
+
"windMps": 2.2,
|
|
59
|
+
"windDirectionDeg": 288
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"observedAt": "2026-08-05T22:12:42.000Z",
|
|
63
|
+
"windMps": 2.7,
|
|
64
|
+
"windDirectionDeg": 291
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"observedAt": "2026-08-05T22:12:45.000Z",
|
|
68
|
+
"windMps": 0.3,
|
|
69
|
+
"windDirectionDeg": null
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -128,6 +128,26 @@
|
|
|
128
128
|
"type": "null"
|
|
129
129
|
}
|
|
130
130
|
]
|
|
131
|
+
},
|
|
132
|
+
"telemetry": {
|
|
133
|
+
"anyOf": [
|
|
134
|
+
{
|
|
135
|
+
"$ref": "#/$defs/StationTelemetry"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "null"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"samples": {
|
|
143
|
+
"anyOf": [
|
|
144
|
+
{
|
|
145
|
+
"$ref": "#/$defs/LiveSamples"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"type": "null"
|
|
149
|
+
}
|
|
150
|
+
]
|
|
131
151
|
}
|
|
132
152
|
},
|
|
133
153
|
"required": [
|
|
@@ -289,6 +309,28 @@
|
|
|
289
309
|
},
|
|
290
310
|
"history": {
|
|
291
311
|
"type": "boolean"
|
|
312
|
+
},
|
|
313
|
+
"live": {
|
|
314
|
+
"description": "The station has a live sample stream; absent or null reads as false.",
|
|
315
|
+
"anyOf": [
|
|
316
|
+
{
|
|
317
|
+
"type": "boolean"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"type": "null"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
"battery": {
|
|
325
|
+
"description": "The station reports battery telemetry; absent or null reads as false.",
|
|
326
|
+
"anyOf": [
|
|
327
|
+
{
|
|
328
|
+
"type": "boolean"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"type": "null"
|
|
332
|
+
}
|
|
333
|
+
]
|
|
292
334
|
}
|
|
293
335
|
},
|
|
294
336
|
"required": [
|
|
@@ -636,6 +678,79 @@
|
|
|
636
678
|
"windDirectionDeg",
|
|
637
679
|
"temperatureC"
|
|
638
680
|
]
|
|
681
|
+
},
|
|
682
|
+
"StationTelemetry": {
|
|
683
|
+
"type": "object",
|
|
684
|
+
"properties": {
|
|
685
|
+
"batteryVoltage": {
|
|
686
|
+
"anyOf": [
|
|
687
|
+
{
|
|
688
|
+
"type": "number"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
"type": "null"
|
|
692
|
+
}
|
|
693
|
+
],
|
|
694
|
+
"description": "Station supply volts. null means 'not reported here', never a dead battery."
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
"required": [
|
|
698
|
+
"batteryVoltage"
|
|
699
|
+
],
|
|
700
|
+
"description": "Device telemetry. The station-level battery capability gates whether a client allocates UI structure; a dark sensor keeps its structure and reports null."
|
|
701
|
+
},
|
|
702
|
+
"LiveSamples": {
|
|
703
|
+
"type": "object",
|
|
704
|
+
"properties": {
|
|
705
|
+
"intervalSeconds": {
|
|
706
|
+
"type": "number",
|
|
707
|
+
"exclusiveMinimum": 0,
|
|
708
|
+
"description": "Seconds between samples."
|
|
709
|
+
},
|
|
710
|
+
"points": {
|
|
711
|
+
"type": "array",
|
|
712
|
+
"items": {
|
|
713
|
+
"$ref": "#/$defs/LiveSample"
|
|
714
|
+
},
|
|
715
|
+
"description": "Oldest first. A dropout is an ABSENT sample, never a zeroed one."
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
"required": [
|
|
719
|
+
"intervalSeconds",
|
|
720
|
+
"points"
|
|
721
|
+
]
|
|
722
|
+
},
|
|
723
|
+
"LiveSample": {
|
|
724
|
+
"type": "object",
|
|
725
|
+
"properties": {
|
|
726
|
+
"observedAt": {
|
|
727
|
+
"type": "string",
|
|
728
|
+
"format": "date-time"
|
|
729
|
+
},
|
|
730
|
+
"windMps": {
|
|
731
|
+
"type": "number",
|
|
732
|
+
"minimum": 0,
|
|
733
|
+
"description": "Instantaneous m/s — a single anemometer sample, not a period mean."
|
|
734
|
+
},
|
|
735
|
+
"windDirectionDeg": {
|
|
736
|
+
"anyOf": [
|
|
737
|
+
{
|
|
738
|
+
"type": "number",
|
|
739
|
+
"minimum": 0,
|
|
740
|
+
"exclusiveMaximum": 360
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
"type": "null"
|
|
744
|
+
}
|
|
745
|
+
],
|
|
746
|
+
"description": "Degrees FROM; null exactly when calm (below 0.5 m/s)."
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
"required": [
|
|
750
|
+
"observedAt",
|
|
751
|
+
"windMps",
|
|
752
|
+
"windDirectionDeg"
|
|
753
|
+
]
|
|
639
754
|
}
|
|
640
755
|
}
|
|
641
756
|
}
|
|
@@ -143,6 +143,26 @@
|
|
|
143
143
|
"type": "null"
|
|
144
144
|
}
|
|
145
145
|
]
|
|
146
|
+
},
|
|
147
|
+
"telemetry": {
|
|
148
|
+
"anyOf": [
|
|
149
|
+
{
|
|
150
|
+
"$ref": "#/$defs/StationTelemetry"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"type": "null"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"samples": {
|
|
158
|
+
"anyOf": [
|
|
159
|
+
{
|
|
160
|
+
"$ref": "#/$defs/LiveSamples"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"type": "null"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
146
166
|
}
|
|
147
167
|
},
|
|
148
168
|
"required": [
|
|
@@ -304,6 +324,28 @@
|
|
|
304
324
|
},
|
|
305
325
|
"history": {
|
|
306
326
|
"type": "boolean"
|
|
327
|
+
},
|
|
328
|
+
"live": {
|
|
329
|
+
"description": "The station has a live sample stream; absent or null reads as false.",
|
|
330
|
+
"anyOf": [
|
|
331
|
+
{
|
|
332
|
+
"type": "boolean"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"type": "null"
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
},
|
|
339
|
+
"battery": {
|
|
340
|
+
"description": "The station reports battery telemetry; absent or null reads as false.",
|
|
341
|
+
"anyOf": [
|
|
342
|
+
{
|
|
343
|
+
"type": "boolean"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"type": "null"
|
|
347
|
+
}
|
|
348
|
+
]
|
|
307
349
|
}
|
|
308
350
|
},
|
|
309
351
|
"required": [
|
|
@@ -651,6 +693,79 @@
|
|
|
651
693
|
"windDirectionDeg",
|
|
652
694
|
"temperatureC"
|
|
653
695
|
]
|
|
696
|
+
},
|
|
697
|
+
"StationTelemetry": {
|
|
698
|
+
"type": "object",
|
|
699
|
+
"properties": {
|
|
700
|
+
"batteryVoltage": {
|
|
701
|
+
"anyOf": [
|
|
702
|
+
{
|
|
703
|
+
"type": "number"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"type": "null"
|
|
707
|
+
}
|
|
708
|
+
],
|
|
709
|
+
"description": "Station supply volts. null means 'not reported here', never a dead battery."
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
"required": [
|
|
713
|
+
"batteryVoltage"
|
|
714
|
+
],
|
|
715
|
+
"description": "Device telemetry. The station-level battery capability gates whether a client allocates UI structure; a dark sensor keeps its structure and reports null."
|
|
716
|
+
},
|
|
717
|
+
"LiveSamples": {
|
|
718
|
+
"type": "object",
|
|
719
|
+
"properties": {
|
|
720
|
+
"intervalSeconds": {
|
|
721
|
+
"type": "number",
|
|
722
|
+
"exclusiveMinimum": 0,
|
|
723
|
+
"description": "Seconds between samples."
|
|
724
|
+
},
|
|
725
|
+
"points": {
|
|
726
|
+
"type": "array",
|
|
727
|
+
"items": {
|
|
728
|
+
"$ref": "#/$defs/LiveSample"
|
|
729
|
+
},
|
|
730
|
+
"description": "Oldest first. A dropout is an ABSENT sample, never a zeroed one."
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
"required": [
|
|
734
|
+
"intervalSeconds",
|
|
735
|
+
"points"
|
|
736
|
+
]
|
|
737
|
+
},
|
|
738
|
+
"LiveSample": {
|
|
739
|
+
"type": "object",
|
|
740
|
+
"properties": {
|
|
741
|
+
"observedAt": {
|
|
742
|
+
"type": "string",
|
|
743
|
+
"format": "date-time"
|
|
744
|
+
},
|
|
745
|
+
"windMps": {
|
|
746
|
+
"type": "number",
|
|
747
|
+
"minimum": 0,
|
|
748
|
+
"description": "Instantaneous m/s — a single anemometer sample, not a period mean."
|
|
749
|
+
},
|
|
750
|
+
"windDirectionDeg": {
|
|
751
|
+
"anyOf": [
|
|
752
|
+
{
|
|
753
|
+
"type": "number",
|
|
754
|
+
"minimum": 0,
|
|
755
|
+
"exclusiveMaximum": 360
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"type": "null"
|
|
759
|
+
}
|
|
760
|
+
],
|
|
761
|
+
"description": "Degrees FROM; null exactly when calm (below 0.5 m/s)."
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
"required": [
|
|
765
|
+
"observedAt",
|
|
766
|
+
"windMps",
|
|
767
|
+
"windDirectionDeg"
|
|
768
|
+
]
|
|
654
769
|
}
|
|
655
770
|
}
|
|
656
771
|
}
|