From 0b2bc6831335edb514087b13a439b925c144ea86 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Tue, 24 Oct 2023 17:11:18 +0300 Subject: [PATCH] Update 107.md --- 107.md | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/107.md b/107.md index 7c8de00..aafedc2 100644 --- a/107.md +++ b/107.md @@ -33,21 +33,16 @@ The `device` can also push data such as sensor readings and updates. A `device` can publish any of the events described in [NIP-91 Event Kinds](https://github.com/nostr-protocol/nips/blob/iot/91.md#event-kinds). A `user` can publish these event kinds: -| Kind | | Description | NIP | -|--------|----------|-------------------------------|-----------------------------------------------------------------------------------------| -| `8000` | `intent` | Trigger an action on a device | [NIP-91 Event Kinds](https://github.com/nostr-protocol/nips/blob/iot/91.md#event-kinds) | +| Kind | | Description | NIP | +|---------|----------|-------------------------------|-----------------------------------------------------------------------------------------| +| `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-91 Event Kinds](https://github.com/nostr-protocol/nips/blob/iot/91.md#event-kinds) | + 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). -## Intent Events -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` which `MUST` have a `type` field indicating the what the JSON represents. Possible types: - -| Message Type | Sent By | Description | -|--------------|----------------|------------------| -| 0 | User | Configure Device | - -### Configure Device -This message is sent by a `user` to a `device`. The `device` saves the config locally and then uses it. +### Configure Device Event (`kind: 30107`) +This message is sent by an admin `user` to a `device`. The `device` saves the config locally and then uses it. **Event Content**: ```json @@ -61,6 +56,7 @@ This message is sent by a `user` to a `device`. The `device` saves the config lo "intents_from_pubkeys":[ []], "publish_on_change": , "publish_interval": + "unix_time": } ``` @@ -70,18 +66,30 @@ This message is sent by a `user` to a `device`. The `device` saves the config lo | `publish_to_pubkeys` | List of public keys to which events are published. | | `actions_from_pubkeys` | List of public keys that are allowed to trigger an action on this device.
The `admin_pubkeys` implicitly have the `actions_from_pubkeys` permissions. | -### Event: Update a `device` -**Event Content**: +> [!IMPORTANT] +> The content of the `30107` event should be encrypted if the user chooses the "encrypted" mode + +**Event Tags**: ```json -{ - "id": , - "device_id": , - "settings":[ []] -} + "tags": [["d", ], ["range", ], ["timer_on", ], ["timer_off", ]]` + +**Event Tags**: +```json + "tags": [["d",