From 54dbeac2f2dba2da3b7bc6cb54b6c92b80c1f8fe Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 11 Oct 2023 10:45:18 -0300 Subject: NIP-91 IoT skeleton. --- 91.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 91.md (limited to '91.md') diff --git a/91.md b/91.md new file mode 100644 index 0000000..6979c3f --- /dev/null +++ b/91.md @@ -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": , + "tags": [ + ["device", ], + ["alt", ], + ], + "content": "" + ... +} +``` + +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 | -- cgit v1.2.3