-
Notifications
You must be signed in to change notification settings - Fork 741
nip/weather-data #2163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
nip/weather-data #2163
Changes from 1 commit
5172534
8b61146
bf6968f
0dc11a0
3fd4849
8c2741e
83493ac
439b10d
16a92a0
d2cf45e
e52921f
46a52b2
d96661d
df9c208
1f98345
383bf6b
380eeef
8474854
08b8ed5
e223a2e
ce949bb
87c2b09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| NIP-Weather | ||
| =========== | ||
|
|
||
| Weather Data | ||
| ------------ | ||
|
|
||
| `draft` `optional` | ||
|
|
||
| This NIP defines event types for publishing weather station metadata and sensor readings on Nostr. | ||
|
|
||
| ## Weather Station Metadata (`kind:16428`) | ||
|
|
||
| A replaceable event describing a weather station's configuration and capabilities. Since `kind:16428` is in the replaceable range (10000-19999), there is one metadata event per pubkey. Each station should have its own pubkey/identity. | ||
|
|
||
| ```jsonc | ||
| { | ||
| "kind": 16428, | ||
| "tags": [ | ||
| ["sensor", "temp"], | ||
| ["sensor", "humidity"], | ||
| ["sensor", "pm25"] | ||
| ], | ||
| "content": "{\"name\":\"Backyard Station\",\"location\":[37.7749,-122.4194],\"elevation\":52,\"sensors\":{\"temp\":{\"model\":\"DS18B20\"},\"pm25\":{\"model\":\"SDS011\"}}}" | ||
| } | ||
| ``` | ||
|
|
||
| Tags: | ||
| - `sensor` (repeatable): Sensor types available. Used for filtering/discovery (relays can index these). | ||
|
|
||
| Content: JSON object with optional fields. Not indexed by relays, but flexible for structured data: | ||
| - `name`: Human-readable station name | ||
| - `location`: Array `[latitude, longitude]` in decimal degrees | ||
| - `elevation`: Elevation in meters above sea level | ||
| - `sensors`: Object with detailed sensor information (model, calibration, etc.) | ||
| - Other fields as needed | ||
|
|
||
| To group multiple stations together, use [NIP-51](51.md) lists. `kind:30001` (generic lists) can be used with `p` tags referencing station pubkeys. Example: | ||
|
|
||
| ```jsonc | ||
| { | ||
| "kind": 30001, | ||
| "tags": [ | ||
| ["d", "my-stations"], | ||
| ["title", "My Weather Stations"], | ||
| ["p", "<station1-pubkey>"], | ||
| ["p", "<station2-pubkey>"] | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ## Weather Station Readings (`kind:23415`) | ||
|
|
||
| Ephemeral events containing sensor readings. Since `kind:23415` is in the ephemeral range (20000-29999), relays are not expected to store these events (though they may choose to). For persistent storage of readings, use a regular kind (1000-9999). Tags are used for relationships/filtering, content contains the actual sensor data. | ||
|
|
||
| ```jsonc | ||
| { | ||
| "kind": 23415, | ||
| "tags": [ | ||
| ["s", "<station-id>"], | ||
| ["a", "16428:<pubkey>", "<relay-url>"] | ||
|
||
| ], | ||
| "content": "{\"temp\":22.5,\"humidity\":65.2,\"pm25\":12.3}" | ||
| } | ||
| ``` | ||
|
|
||
| Tags: | ||
| - `s` (optional): Station identifier for filtering readings by station | ||
| - `a` (optional): Reference to the metadata event (`16428:<pubkey>`) | ||
|
|
||
| Content: JSON object with sensor readings. Fields are optional and depend on available sensors. Common fields: | ||
| - `temp`: Temperature in Celsius | ||
| - `humidity`: Relative humidity (0-100) | ||
| - `pm25`, `pm10`: Air quality in µg/m³ | ||
|
|
||
| ## Open Questions | ||
|
|
||
| ### Event Kind Range for Readings | ||
|
|
||
| Currently `kind:23415` is ephemeral (20000-29999), meaning relays are not expected to store readings. Should readings use regular events (1000-9999) instead to enable historical data queries and trend analysis? Tradeoff: storage burden vs. historical value. | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure grouping stations needs to be part of this nip. I don't see any harm in it though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, please see my response above to elsat and kindly share any thoughts you have.