mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-22 08:46:30 +00:00
Update websocket.md (#754)
Add context to the example outputs. Brings documentation inline with actual output from these commands.
This commit is contained in:
parent
be3a4008d1
commit
063c16179d
@ -93,15 +93,20 @@ If the data is incorrect, the server will reply with `auth_invalid` message and
|
|||||||
|
|
||||||
## Command phase
|
## Command phase
|
||||||
|
|
||||||
During this phase the client can give commands to the server. The server will respond to each command with a `result` message indicating when the command is done and if it was successful.
|
During this phase the client can give commands to the server. The server will respond to each command with a `result` message indicating when the command is done and if it was successful along with the context of the command.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
"type": "result",
|
"type": "result",
|
||||||
"success": true,
|
"success": true,
|
||||||
// Can contain extra result info
|
"result": {
|
||||||
"result": null
|
"context": {
|
||||||
|
"id": "326ef27d19415c60c492fe330945f954",
|
||||||
|
"parent_id": null,
|
||||||
|
"user_id": "31ddb597e03147118cf8d2f8fbea5553"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -158,7 +163,12 @@ For each event that matches, the server will send a message of type `event`. The
|
|||||||
"white_value":200,
|
"white_value":200,
|
||||||
"friendly_name":"Bed Light"
|
"friendly_name":"Bed Light"
|
||||||
},
|
},
|
||||||
"last_updated":"2016-11-26T01:37:24.265390+00:00"
|
"last_updated":"2016-11-26T01:37:24.265390+00:00",
|
||||||
|
"context": {
|
||||||
|
"id": "326ef27d19415c60c492fe330945f954",
|
||||||
|
"parent_id": null,
|
||||||
|
"user_id": "31ddb597e03147118cf8d2f8fbea5553"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"old_state":{
|
"old_state":{
|
||||||
"entity_id":"light.bed_light",
|
"entity_id":"light.bed_light",
|
||||||
@ -168,12 +178,22 @@ For each event that matches, the server will send a message of type `event`. The
|
|||||||
"supported_features":147,
|
"supported_features":147,
|
||||||
"friendly_name":"Bed Light"
|
"friendly_name":"Bed Light"
|
||||||
},
|
},
|
||||||
"last_updated":"2016-11-26T01:37:10.466994+00:00"
|
"last_updated":"2016-11-26T01:37:10.466994+00:00",
|
||||||
|
"context": {
|
||||||
|
"id": "e4af5b117137425e97658041a0538441",
|
||||||
|
"parent_id": null,
|
||||||
|
"user_id": "31ddb597e03147118cf8d2f8fbea5553"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"event_type":"state_changed",
|
"event_type":"state_changed",
|
||||||
"time_fired":"2016-11-26T01:37:24.265429+00:00",
|
"time_fired":"2016-11-26T01:37:24.265429+00:00",
|
||||||
"origin":"LOCAL"
|
"origin":"LOCAL",
|
||||||
|
"context": {
|
||||||
|
"id": "326ef27d19415c60c492fe330945f954",
|
||||||
|
"parent_id": null,
|
||||||
|
"user_id": "31ddb597e03147118cf8d2f8fbea5553"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user