diff options
| author | fiatjaf <fiatjaf@gmail.com> | 2023-10-11 10:45:18 -0300 |
|---|---|---|
| committer | fiatjaf <fiatjaf@gmail.com> | 2023-10-11 10:50:18 -0300 |
| commit | 54dbeac2f2dba2da3b7bc6cb54b6c92b80c1f8fe (patch) | |
| tree | 614f683c0132d5e473a34362c1c2e1ee876239de | |
| parent | 09ffb951c69343312486aaff2726dca04bc42f6e (diff) | |
NIP-91 IoT skeleton.iot
| -rw-r--r-- | 91.md | 48 | ||||
| -rw-r--r-- | README.md | 112 |
2 files changed, 105 insertions, 55 deletions
| @@ -0,0 +1,48 @@ | |||
| 1 | NIP-91 | ||
| 2 | ====== | ||
| 3 | |||
| 4 | IoT sensors and intents | ||
| 5 | ----------------------- | ||
| 6 | |||
| 7 | `draft` `optional` `author:BlackCoffee` `author:arcbtc` `author:fiatjaf` | ||
| 8 | |||
| 9 | This NIP standardizes communication of public sensor and intent events in order to create an open, pluggable and interoperable standard for "Internet of Things" devices to communicate. | ||
| 10 | |||
| 11 | The standard event format follows the following template: | ||
| 12 | |||
| 13 | ```js | ||
| 14 | { | ||
| 15 | "kind": <a number from the table below>, | ||
| 16 | "tags": [ | ||
| 17 | ["device", <optional device id>], | ||
| 18 | ["alt", <optional human-readable translation of the event>], | ||
| 19 | ], | ||
| 20 | "content": "<data according to the format in the table below>" | ||
| 21 | ... | ||
| 22 | } | ||
| 23 | ``` | ||
| 24 | |||
| 25 | Ideally each device would have its own public key, which allows for easy command-and-control and comes with built-in trus guarantees (i.e. you know you're getting the data from the correct device if you know its key and can check the signature), but the `device` tag exists for when that is too cumbersome and more than one device is using the same key. | ||
| 26 | |||
| 27 | The `alt` tag follows NIP-31 and can accomodate all human-readable needs, like the device name or the human-readable name of the place it is in. | ||
| 28 | |||
| 29 | Other generic tags, like `g` for geolocation, may be included. | ||
| 30 | |||
| 31 | ### Event Kinds | ||
| 32 | |||
| 33 | Kinds between 8000-8999 (inclusive) are reserved for this NIP, to be filled in the table below. | ||
| 34 | |||
| 35 | | kind | name | type | unit | example | description | | ||
| 36 | | ----- | ----- | ------ | ----- | ----- | -------- | | ||
| 37 | | 8000 | intent | | | | someone wants to trigger an action on a device? | | ||
| 38 | | 8001 | on | empty | | | device was turned on | | ||
| 39 | | 8002 | off | empty | | | device will turn off | | ||
| 40 | | 8003 | temperature | number | celsius | 20.9 | | | ||
| 41 | | 8004 | pressure | number | pascals | 1013 | | | ||
| 42 | | 8005 | location | array | decimal degrees | [51.5053, -0.08737] | | | ||
| 43 | | 8006 | light | | | | | | ||
| 44 | | 8007 | humidity | | | | | | ||
| 45 | | 8008 | rain | | | | | | ||
| 46 | | 8009 | moisture | | | | | | ||
| 47 | | 8010 | unary switch | | empty | | a sensor that detects if a thing happened or not | | ||
| 48 | | 8011 | binary switch | boolean | | true / false | a switch that can be turned on or off | | ||
| @@ -67,67 +67,69 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos | |||
| 67 | - [NIP-75: Zap Goals](75.md) | 67 | - [NIP-75: Zap Goals](75.md) |
| 68 | - [NIP-78: Application-specific data](78.md) | 68 | - [NIP-78: Application-specific data](78.md) |
| 69 | - [NIP-89: Recommended Application Handlers](89.md) | 69 | - [NIP-89: Recommended Application Handlers](89.md) |
| 70 | - [NIP-91: IoT Sensors and Intents](91.md) | ||
| 70 | - [NIP-94: File Metadata](94.md) | 71 | - [NIP-94: File Metadata](94.md) |
| 71 | - [NIP-98: HTTP Auth](98.md) | 72 | - [NIP-98: HTTP Auth](98.md) |
| 72 | - [NIP-99: Classified Listings](99.md) | 73 | - [NIP-99: Classified Listings](99.md) |
| 73 | 74 | ||
| 74 | ## Event Kinds | 75 | ## Event Kinds |
| 75 | 76 | ||
| 76 | | kind | description | NIP | | 77 | | kind | description | NIP | |
| 77 | | ------- | -------------------------- | ----------- | | 78 | | ------- | -------------------------- | ----------- | |
| 78 | | `0` | Metadata | [1](01.md) | | 79 | | `0` | Metadata | [1](01.md) | |
| 79 | | `1` | Short Text Note | [1](01.md) | | 80 | | `1` | Short Text Note | [1](01.md) | |
| 80 | | `2` | Recommend Relay | | | 81 | | `2` | Recommend Relay | | |
| 81 | | `3` | Contacts | [2](02.md) | | 82 | | `3` | Contacts | [2](02.md) | |
| 82 | | `4` | Encrypted Direct Messages | [4](04.md) | | 83 | | `4` | Encrypted Direct Messages | [4](04.md) | |
| 83 | | `5` | Event Deletion | [9](09.md) | | 84 | | `5` | Event Deletion | [9](09.md) | |
| 84 | | `6` | Repost | [18](18.md) | | 85 | | `6` | Repost | [18](18.md) | |
| 85 | | `7` | Reaction | [25](25.md) | | 86 | | `7` | Reaction | [25](25.md) | |
| 86 | | `8` | Badge Award | [58](58.md) | | 87 | | `8` | Badge Award | [58](58.md) | |
| 87 | | `16` | Generic Repost | [18](18.md) | | 88 | | `16` | Generic Repost | [18](18.md) | |
| 88 | | `40` | Channel Creation | [28](28.md) | | 89 | | `40` | Channel Creation | [28](28.md) | |
| 89 | | `41` | Channel Metadata | [28](28.md) | | 90 | | `41` | Channel Metadata | [28](28.md) | |
| 90 | | `42` | Channel Message | [28](28.md) | | 91 | | `42` | Channel Message | [28](28.md) | |
| 91 | | `43` | Channel Hide Message | [28](28.md) | | 92 | | `43` | Channel Hide Message | [28](28.md) | |
| 92 | | `44` | Channel Mute User | [28](28.md) | | 93 | | `44` | Channel Mute User | [28](28.md) | |
| 93 | | `1063` | File Metadata | [94](94.md) | | 94 | | `1063` | File Metadata | [94](94.md) | |
| 94 | | `1311` | Live Chat Message | [53](53.md) | | 95 | | `1311` | Live Chat Message | [53](53.md) | |
| 95 | | `1040` | OpenTimestamps | [03](03.md) | | 96 | | `1040` | OpenTimestamps | [03](03.md) | |
| 96 | | `1984` | Reporting | [56](56.md) | | 97 | | `1984` | Reporting | [56](56.md) | |
| 97 | | `1985` | Label | [32](32.md) | | 98 | | `1985` | Label | [32](32.md) | |
| 98 | | `4550` | Community Post Approval | [72](72.md) | | 99 | | `8000-8999` | IoT Sensors and Intents | [91](91.md) | |
| 99 | | `9041` | Zap Goal | [75](75.md) | | 100 | | `4550` | Community Post Approval | [72](72.md) | |
| 100 | | `9734` | Zap Request | [57](57.md) | | 101 | | `9041` | Zap Goal | [75](75.md) | |
| 101 | | `9735` | Zap | [57](57.md) | | 102 | | `9734` | Zap Request | [57](57.md) | |
| 102 | | `10000` | Mute List | [51](51.md) | | 103 | | `9735` | Zap | [57](57.md) | |
| 103 | | `10001` | Pin List | [51](51.md) | | 104 | | `10000` | Mute List | [51](51.md) | |
| 104 | | `10002` | Relay List Metadata | [65](65.md) | | 105 | | `10001` | Pin List | [51](51.md) | |
| 105 | | `13194` | Wallet Info | [47](47.md) | | 106 | | `10002` | Relay List Metadata | [65](65.md) | |
| 106 | | `22242` | Client Authentication | [42](42.md) | | 107 | | `13194` | Wallet Info | [47](47.md) | |
| 107 | | `23194` | Wallet Request | [47](47.md) | | 108 | | `22242` | Client Authentication | [42](42.md) | |
| 108 | | `23195` | Wallet Response | [47](47.md) | | 109 | | `23194` | Wallet Request | [47](47.md) | |
| 109 | | `24133` | Nostr Connect | [46](46.md) | | 110 | | `23195` | Wallet Response | [47](47.md) | |
| 110 | | `27235` | HTTP Auth | [98](98.md) | | 111 | | `24133` | Nostr Connect | [46](46.md) | |
| 111 | | `30000` | Categorized People List | [51](51.md) | | 112 | | `27235` | HTTP Auth | [98](98.md) | |
| 112 | | `30001` | Categorized Bookmark List | [51](51.md) | | 113 | | `30000` | Categorized People List | [51](51.md) | |
| 113 | | `30008` | Profile Badges | [58](58.md) | | 114 | | `30001` | Categorized Bookmark List | [51](51.md) | |
| 114 | | `30009` | Badge Definition | [58](58.md) | | 115 | | `30008` | Profile Badges | [58](58.md) | |
| 115 | | `30017` | Create or update a stall | [15](15.md) | | 116 | | `30009` | Badge Definition | [58](58.md) | |
| 116 | | `30018` | Create or update a product | [15](15.md) | | 117 | | `30017` | Create or update a stall | [15](15.md) | |
| 117 | | `30023` | Long-form Content | [23](23.md) | | 118 | | `30018` | Create or update a product | [15](15.md) | |
| 118 | | `30024` | Draft Long-form Content | [23](23.md) | | 119 | | `30023` | Long-form Content | [23](23.md) | |
| 119 | | `30078` | Application-specific Data | [78](78.md) | | 120 | | `30024` | Draft Long-form Content | [23](23.md) | |
| 120 | | `30311` | Live Event | [53](53.md) | | 121 | | `30078` | Application-specific Data | [78](78.md) | |
| 121 | | `30315` | User Statuses | [38](38.md) | | 122 | | `30311` | Live Event | [53](53.md) | |
| 122 | | `30402` | Classified Listing | [99](99.md) | | 123 | | `30315` | User Statuses | [38](38.md) | |
| 123 | | `30403` | Draft Classified Listing | [99](99.md) | | 124 | | `30402` | Classified Listing | [99](99.md) | |
| 124 | | `31922` | Date-Based Calendar Event | [52](52.md) | | 125 | | `30403` | Draft Classified Listing | [99](99.md) | |
| 125 | | `31923` | Time-Based Calendar Event | [52](52.md) | | 126 | | `31922` | Date-Based Calendar Event | [52](52.md) | |
| 126 | | `31924` | Calendar | [52](52.md) | | 127 | | `31923` | Time-Based Calendar Event | [52](52.md) | |
| 127 | | `31925` | Calendar Event RSVP | [52](52.md) | | 128 | | `31924` | Calendar | [52](52.md) | |
| 128 | | `31989` | Handler recommendation | [89](89.md) | | 129 | | `31925` | Calendar Event RSVP | [52](52.md) | |
| 129 | | `31990` | Handler information | [89](89.md) | | 130 | | `31989` | Handler recommendation | [89](89.md) | |
| 130 | | `34550` | Community Definition | [72](72.md) | | 131 | | `31990` | Handler information | [89](89.md) | |
| 132 | | `34550` | Community Definition | [72](72.md) | | ||
| 131 | 133 | ||
| 132 | 134 | ||
| 133 | ## Message types | 135 | ## Message types |