diff options
Diffstat (limited to '91.md')
| -rw-r--r-- | 91.md | 48 |
1 files changed, 48 insertions, 0 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 | | ||