Update 107.md

This commit is contained in:
Vlad Stan 2023-10-25 15:07:49 +03:00 committed by GitHub
parent f8789df9dc
commit 8e3c74e03d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

19
107.md
View File

@ -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) | | `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) | | `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). 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 (`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`. 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**: **Event Content**:
```json ```json
[[<Integer, between 8001 and 8999>, <Any Type> ]] {
"on": <bool>,
"temperature": <float Caelsius>,
"watts": <float Watts>
}
``` ```
Example that turns on a device and sets the temperature to `20.9` degrees Celsius: Example that turns on a device and sets the temperature to `20.9` degrees Celsius:
```json ```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`. > 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. Below is a non exhaustive list of data types that may be used in the content of the event.