diff --git a/107.md b/107.md index 0bcac5b..030d56d 100644 --- a/107.md +++ b/107.md @@ -26,23 +26,32 @@ Where the `user` registers 'device'(s) and its keys, then updates the `device`(s ### Device -The `device` uses a client like nostr-arduino to receive commands from the `user` or another `device`. +The `device` uses a client like nostr-arduino to receive commands from the `user` or another `device`. The `device` can also push data such as sensor readings and updates. -## `User` OR `device` registering/updating a `user` OR `device` +## Events A `device` or a `user` can publish these event kinds: | Kind | | Description | NIP | |---------|------------------|---------------------------------------------------------------------------------------------------------------|-----------------------------------------| -| `4 ` | `direct_message` | Communicate between two `devices` or between a `device` and a `user`.
The messages must be a JSON following the structure defined In this NIP. | [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md) | +| `4 ` | `direct_message` | Communicate between two `devices` or between a `device` and a `user`.
The messages must be a JSON following the structures defined In this NIP. | [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md) | +### Messages +JSON messages that represent different actions or states can be exchanged between two or more `devices` or between `users` and `devices`. +Each `JSON` message `MUST` have a `type` field indicating the what the JSON represents. Possible types: -### Event: Register a `device` +| Message Type | Sent By | Description | +|--------------|----------------|------------------| +| 0 | User | Configure Device | +| 1 | User \| Device | Command | +| 2 | Device | State Data | + +### Event: Configure `device` **Event Content**: ```json { - "id": , + "type": , "device_id": , "name": , "description": ,