From 8e3c74e03d052d63ed7de2805ceb04c0756feb28 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Wed, 25 Oct 2023 15:07:49 +0300 Subject: [PATCH] Update 107.md --- 107.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/107.md b/107.md index 0e82dc86..0abac80f 100644 --- a/107.md +++ b/107.md @@ -37,7 +37,7 @@ A `user` can publish these event kinds: |---------|----------|-------------------------------|-----------------------------------------------------------------------------------------| | `30107` | `config` | Configure a device | [NIP-107 Configure Device Event](https://github.com/arcbtc/nips/edit/nip_107/107.md#configure-device-event) | | `8000` | `intent` | Trigger an action on a device | [NIP-107 Intent Event](https://github.com/arcbtc/nips/blob/107/107.md#intent-events-kind-8000) | -| `8001. | `data` | Publish the state of a `device` | [NIP-91 Event Kinds](https://github.com/nostr-protocol/nips/blob/iot/91.md#event-kinds) | +| `8001` | `data` | Publish the state of a `device` | [NIP-107 Data Event](https://github.com/arcbtc/nips/blob/107/107.md#data-events-kind-8001) | The content of events can be transmitted in clear text (for public data) or as [NIP-59 Gift Wrap](https://github.com/staab/nips/blob/NIP-59/59.md). @@ -81,16 +81,25 @@ This message is sent by an admin `user` to a `device`. The `device` saves the co ### Intent Events (`kind: 8000`) --- Intent Events represent different actions that can be performed on a device. These actions can be triggered by a `user` or by another `device`. -The content of the event is a `JSON` array representing the data type and the data value as specified in [NIP-91 Event Kinds](https://github.com/nostr-protocol/nips/blob/iot/91.md#event-kinds) +The content of the event is a `JSON` object where for each field: + - the key must correspond to the `name` value of an entry from the [Data Types](https://github.com/arcbtc/nips/blob/107/107.md#data-events-kind-8001) table + - the value represents the actual **Event Content**: ```json - [[, ]] +{ + "on": , + "temperature": , + "watts": +} ``` Example that turns on a device and sets the temperature to `20.9` degrees Celsius: ```json -[[8001, true], [8003, 20.9]] +{ + "on": true, + "temperature": 20.9 +} ``` @@ -118,7 +127,7 @@ Data Events represent data published by `device`(s). The `kind` of the event and > If the transmission mode is encrypted ([NIP-59 Gift Wrap](https://github.com/staab/nips/blob/NIP-59/59.md)) then an individual message must be published for each public key in `publish_to_pubkeys`. > > -## Data types +## Data Types Below is a non exhaustive list of data types that may be used in the content of the event.