NIP-91 IoT skeleton.

This commit is contained in:
fiatjaf 2023-10-11 10:45:18 -03:00
parent 09ffb951c6
commit 54dbeac2f2
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
2 changed files with 105 additions and 55 deletions

48
91.md Normal file
View File

@ -0,0 +1,48 @@
NIP-91
======
IoT sensors and intents
-----------------------
`draft` `optional` `author:BlackCoffee` `author:arcbtc` `author:fiatjaf`
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.
The standard event format follows the following template:
```js
{
"kind": <a number from the table below>,
"tags": [
["device", <optional device id>],
["alt", <optional human-readable translation of the event>],
],
"content": "<data according to the format in the table below>"
...
}
```
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.
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.
Other generic tags, like `g` for geolocation, may be included.
### Event Kinds
Kinds between 8000-8999 (inclusive) are reserved for this NIP, to be filled in the table below.
| kind | name | type | unit | example | description |
| ----- | ----- | ------ | ----- | ----- | -------- |
| 8000 | intent | | | | someone wants to trigger an action on a device? |
| 8001 | on | empty | | | device was turned on |
| 8002 | off | empty | | | device will turn off |
| 8003 | temperature | number | celsius | 20.9 | |
| 8004 | pressure | number | pascals | 1013 | |
| 8005 | location | array | decimal degrees | [51.5053, -0.08737] | |
| 8006 | light | | | | |
| 8007 | humidity | | | | |
| 8008 | rain | | | | |
| 8009 | moisture | | | | |
| 8010 | unary switch | | empty | | a sensor that detects if a thing happened or not |
| 8011 | binary switch | boolean | | true / false | a switch that can be turned on or off |

112
README.md
View File

@ -67,67 +67,69 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
- [NIP-75: Zap Goals](75.md) - [NIP-75: Zap Goals](75.md)
- [NIP-78: Application-specific data](78.md) - [NIP-78: Application-specific data](78.md)
- [NIP-89: Recommended Application Handlers](89.md) - [NIP-89: Recommended Application Handlers](89.md)
- [NIP-91: IoT Sensors and Intents](91.md)
- [NIP-94: File Metadata](94.md) - [NIP-94: File Metadata](94.md)
- [NIP-98: HTTP Auth](98.md) - [NIP-98: HTTP Auth](98.md)
- [NIP-99: Classified Listings](99.md) - [NIP-99: Classified Listings](99.md)
## Event Kinds ## Event Kinds
| kind | description | NIP | | kind | description | NIP |
| ------- | -------------------------- | ----------- | | ------- | -------------------------- | ----------- |
| `0` | Metadata | [1](01.md) | | `0` | Metadata | [1](01.md) |
| `1` | Short Text Note | [1](01.md) | | `1` | Short Text Note | [1](01.md) |
| `2` | Recommend Relay | | | `2` | Recommend Relay | |
| `3` | Contacts | [2](02.md) | | `3` | Contacts | [2](02.md) |
| `4` | Encrypted Direct Messages | [4](04.md) | | `4` | Encrypted Direct Messages | [4](04.md) |
| `5` | Event Deletion | [9](09.md) | | `5` | Event Deletion | [9](09.md) |
| `6` | Repost | [18](18.md) | | `6` | Repost | [18](18.md) |
| `7` | Reaction | [25](25.md) | | `7` | Reaction | [25](25.md) |
| `8` | Badge Award | [58](58.md) | | `8` | Badge Award | [58](58.md) |
| `16` | Generic Repost | [18](18.md) | | `16` | Generic Repost | [18](18.md) |
| `40` | Channel Creation | [28](28.md) | | `40` | Channel Creation | [28](28.md) |
| `41` | Channel Metadata | [28](28.md) | | `41` | Channel Metadata | [28](28.md) |
| `42` | Channel Message | [28](28.md) | | `42` | Channel Message | [28](28.md) |
| `43` | Channel Hide Message | [28](28.md) | | `43` | Channel Hide Message | [28](28.md) |
| `44` | Channel Mute User | [28](28.md) | | `44` | Channel Mute User | [28](28.md) |
| `1063` | File Metadata | [94](94.md) | | `1063` | File Metadata | [94](94.md) |
| `1311` | Live Chat Message | [53](53.md) | | `1311` | Live Chat Message | [53](53.md) |
| `1040` | OpenTimestamps | [03](03.md) | | `1040` | OpenTimestamps | [03](03.md) |
| `1984` | Reporting | [56](56.md) | | `1984` | Reporting | [56](56.md) |
| `1985` | Label | [32](32.md) | | `1985` | Label | [32](32.md) |
| `4550` | Community Post Approval | [72](72.md) | | `8000-8999` | IoT Sensors and Intents | [91](91.md) |
| `9041` | Zap Goal | [75](75.md) | | `4550` | Community Post Approval | [72](72.md) |
| `9734` | Zap Request | [57](57.md) | | `9041` | Zap Goal | [75](75.md) |
| `9735` | Zap | [57](57.md) | | `9734` | Zap Request | [57](57.md) |
| `10000` | Mute List | [51](51.md) | | `9735` | Zap | [57](57.md) |
| `10001` | Pin List | [51](51.md) | | `10000` | Mute List | [51](51.md) |
| `10002` | Relay List Metadata | [65](65.md) | | `10001` | Pin List | [51](51.md) |
| `13194` | Wallet Info | [47](47.md) | | `10002` | Relay List Metadata | [65](65.md) |
| `22242` | Client Authentication | [42](42.md) | | `13194` | Wallet Info | [47](47.md) |
| `23194` | Wallet Request | [47](47.md) | | `22242` | Client Authentication | [42](42.md) |
| `23195` | Wallet Response | [47](47.md) | | `23194` | Wallet Request | [47](47.md) |
| `24133` | Nostr Connect | [46](46.md) | | `23195` | Wallet Response | [47](47.md) |
| `27235` | HTTP Auth | [98](98.md) | | `24133` | Nostr Connect | [46](46.md) |
| `30000` | Categorized People List | [51](51.md) | | `27235` | HTTP Auth | [98](98.md) |
| `30001` | Categorized Bookmark List | [51](51.md) | | `30000` | Categorized People List | [51](51.md) |
| `30008` | Profile Badges | [58](58.md) | | `30001` | Categorized Bookmark List | [51](51.md) |
| `30009` | Badge Definition | [58](58.md) | | `30008` | Profile Badges | [58](58.md) |
| `30017` | Create or update a stall | [15](15.md) | | `30009` | Badge Definition | [58](58.md) |
| `30018` | Create or update a product | [15](15.md) | | `30017` | Create or update a stall | [15](15.md) |
| `30023` | Long-form Content | [23](23.md) | | `30018` | Create or update a product | [15](15.md) |
| `30024` | Draft Long-form Content | [23](23.md) | | `30023` | Long-form Content | [23](23.md) |
| `30078` | Application-specific Data | [78](78.md) | | `30024` | Draft Long-form Content | [23](23.md) |
| `30311` | Live Event | [53](53.md) | | `30078` | Application-specific Data | [78](78.md) |
| `30315` | User Statuses | [38](38.md) | | `30311` | Live Event | [53](53.md) |
| `30402` | Classified Listing | [99](99.md) | | `30315` | User Statuses | [38](38.md) |
| `30403` | Draft Classified Listing | [99](99.md) | | `30402` | Classified Listing | [99](99.md) |
| `31922` | Date-Based Calendar Event | [52](52.md) | | `30403` | Draft Classified Listing | [99](99.md) |
| `31923` | Time-Based Calendar Event | [52](52.md) | | `31922` | Date-Based Calendar Event | [52](52.md) |
| `31924` | Calendar | [52](52.md) | | `31923` | Time-Based Calendar Event | [52](52.md) |
| `31925` | Calendar Event RSVP | [52](52.md) | | `31924` | Calendar | [52](52.md) |
| `31989` | Handler recommendation | [89](89.md) | | `31925` | Calendar Event RSVP | [52](52.md) |
| `31990` | Handler information | [89](89.md) | | `31989` | Handler recommendation | [89](89.md) |
| `34550` | Community Definition | [72](72.md) | | `31990` | Handler information | [89](89.md) |
| `34550` | Community Definition | [72](72.md) |
## Message types ## Message types