diff --git a/atom.xml b/atom.xml index e1b14eca6e..9a44fc05fc 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/community/atom.xml b/blog/categories/community/atom.xml index be1790dd2a..8baa95fc5f 100644 --- a/blog/categories/community/atom.xml +++ b/blog/categories/community/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: community | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/device-tracking/atom.xml b/blog/categories/device-tracking/atom.xml index 2a0914f7a1..32cd6fa227 100644 --- a/blog/categories/device-tracking/atom.xml +++ b/blog/categories/device-tracking/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Device-Tracking | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/esp8266/atom.xml b/blog/categories/esp8266/atom.xml index 6926ce6aa2..3b5b224d7d 100644 --- a/blog/categories/esp8266/atom.xml +++ b/blog/categories/esp8266/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: ESP8266 | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/how-to/atom.xml b/blog/categories/how-to/atom.xml index c60ba44018..34cce54307 100644 --- a/blog/categories/how-to/atom.xml +++ b/blog/categories/how-to/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: How-To | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/ibeacons/atom.xml b/blog/categories/ibeacons/atom.xml index f5e767485a..f29afd7330 100644 --- a/blog/categories/ibeacons/atom.xml +++ b/blog/categories/ibeacons/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: iBeacons | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/internet-of-things/atom.xml b/blog/categories/internet-of-things/atom.xml index ece364774c..d3ceb9f811 100644 --- a/blog/categories/internet-of-things/atom.xml +++ b/blog/categories/internet-of-things/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Internet-of-Things | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/iot-data/atom.xml b/blog/categories/iot-data/atom.xml index f71bd1283a..39ae3aefcc 100644 --- a/blog/categories/iot-data/atom.xml +++ b/blog/categories/iot-data/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: IoT-Data | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/micropython/atom.xml b/blog/categories/micropython/atom.xml index eaf0d78da3..228e21f147 100644 --- a/blog/categories/micropython/atom.xml +++ b/blog/categories/micropython/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Micropython | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/mqtt/atom.xml b/blog/categories/mqtt/atom.xml index adda2052f4..cfed3673cd 100644 --- a/blog/categories/mqtt/atom.xml +++ b/blog/categories/mqtt/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: MQTT | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/organisation/atom.xml b/blog/categories/organisation/atom.xml index 896ba1162f..f8416a4fb0 100644 --- a/blog/categories/organisation/atom.xml +++ b/blog/categories/organisation/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Organisation | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/owntracks/atom.xml b/blog/categories/owntracks/atom.xml index 2747a11abc..551146b0b3 100644 --- a/blog/categories/owntracks/atom.xml +++ b/blog/categories/owntracks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: OwnTracks | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/presence-detection/atom.xml b/blog/categories/presence-detection/atom.xml index 0f66c83369..20b3a33b8f 100644 --- a/blog/categories/presence-detection/atom.xml +++ b/blog/categories/presence-detection/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Presence-Detection | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/public-service-announcement/atom.xml b/blog/categories/public-service-announcement/atom.xml index 6344e97c24..bf06c4481f 100644 --- a/blog/categories/public-service-announcement/atom.xml +++ b/blog/categories/public-service-announcement/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Public-Service-Announcement | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/release-notes/atom.xml b/blog/categories/release-notes/atom.xml index 52c1fc52f9..4a56c09280 100644 --- a/blog/categories/release-notes/atom.xml +++ b/blog/categories/release-notes/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Release-Notes | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/survey/atom.xml b/blog/categories/survey/atom.xml index 17aac1de30..6a19c24ca1 100644 --- a/blog/categories/survey/atom.xml +++ b/blog/categories/survey/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Survey | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/talks/atom.xml b/blog/categories/talks/atom.xml index 828ee04219..4a57d05d7d 100644 --- a/blog/categories/talks/atom.xml +++ b/blog/categories/talks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Talks | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/technology/atom.xml b/blog/categories/technology/atom.xml index 5aa3c052c0..a3c97c54fb 100644 --- a/blog/categories/technology/atom.xml +++ b/blog/categories/technology/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Technology | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/user-stories/atom.xml b/blog/categories/user-stories/atom.xml index 03f2b9fbdd..7fb03752e3 100644 --- a/blog/categories/user-stories/atom.xml +++ b/blog/categories/user-stories/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: User-Stories | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/video/atom.xml b/blog/categories/video/atom.xml index 6ac7993ed6..881609c1c8 100644 --- a/blog/categories/video/atom.xml +++ b/blog/categories/video/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Video | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index aefd54ca94..2f4f5fd65f 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Website | Home Assistant]]> - 2017-02-02T08:27:03+00:00 + 2017-02-02T11:08:02+00:00 https://home-assistant.io/ diff --git a/developers/websocket_api/index.html b/developers/websocket_api/index.html index 7fe66cc531..7f0d48180a 100644 --- a/developers/websocket_api/index.html +++ b/developers/websocket_api/index.html @@ -96,7 +96,7 @@
  • JavaScript - powers the frontend
  • -

    Server states

    +

    Server states

    1. Client connects
    2. @@ -116,176 +116,189 @@ b. Server can send results of previous commands.

      During the command phase, the client attaches a unique identifier to each message. The server will add this identifier to each message so that the client can link each message to it’s origin.

      -

      Message format

      +

      Message format

      Each API message is a JSON serialized object containing a type key. After the authentication phase messages also must contain an id, an integer that contains the number of interactions.

      Example of an auth message:

      -
      {
      -  "type": "auth",
      -  "api_password": "supersecret"
      -}
      -
      +
      {
      +  "type": "auth",
      +  "api_password": "supersecret"
      +}
      +
      +
      -
      {
      -   "id" 5,
      -   "type":"event",
      -   "event":{
      -      "data":{},
      -      "event_type":"test_event",
      -      "time_fired":"2016-11-26T01:37:24.265429+00:00",
      -      "origin":"LOCAL"
      -   }
      -}
      -
      +
      {
      +   "id" 5,
      +   "type":"event",
      +   "event":{
      +      "data":{},
      +      "event_type":"test_event",
      +      "time_fired":"2016-11-26T01:37:24.265429+00:00",
      +      "origin":"LOCAL"
      +   }
      +}
      +
      +
      -

      Authentication phase

      +

      Authentication phase

      When a client connects to the server, the server will test if the client is authenticated. Authentication will not be necessary if no api_password is set or if the user fulfills one of the other criteria for authentication (trusted network, password in url/header).

      If no authentication is needed, the authentication phase will complete and the server will send an auth_ok message.

      -
      {
      -  "type": "auth_ok"
      -}
      -
      +
      {
      +  "type": "auth_ok"
      +}
      +
      +

      If authentication is necessary, the server sends out auth_required.

      -
      {
      -  "type": "auth_required"
      -}
      -
      +
      {
      +  "type": "auth_required"
      +}
      +
      +

      This means that the next message from the client should be an auth message:

      -
      {
      -  "type": "auth",
      -  "api_password": "supersecret"
      -}
      -
      +
      {
      +  "type": "auth",
      +  "api_password": "supersecret"
      +}
      +
      +

      If the client supplies valid authentication, the authentication phase will complete by the server sending the auth_ok message:

      -
      {
      -  "type": "auth_ok"
      -}
      -
      +
      {
      +  "type": "auth_ok"
      +}
      +
      +

      If the data is incorrect, the server will reply with auth_invalid message and disconnect the session.

      -
      {
      -  "type": "auth_invalid",
      -  "message": "Invalid password"
      -}
      -
      +
      {
      +  "type": "auth_invalid",
      +  "message": "Invalid password"
      +}
      +
      +
      -

      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.

      -
      {
      -  "id": 6.
      -  "type": "result",
      -  "success": true,
      -  // Can contain extra result info
      -  "result": null
      -}
      -
      +
      {
      +  "id": 6.
      +  "type": "result",
      +  "success": true,
      +  // Can contain extra result info
      +  "result": null
      +}
      +
      +
      -

      Subscribe to events

      +

      Subscribe to events

      The command subscribe_events will subscribe your client to the event bus. You can either listen to all events or to a specific event type. If you want to listen to multiple event types, you will have to send multiple subscribe_events commands.

      -
      {
      -  "id": 18,
      -  "type": "subscribe_events",
      -  // Optional
      -  "event_type": "state_changed"
      -}
      -
      +
      {
      +  "id": 18,
      +  "type": "subscribe_events",
      +  // Optional
      +  "event_type": "state_changed"
      +}
      +
      +

      The server will respond with a result message to indicate that the subscription is active.

      -
      {
      -  "id": 18,
      -  "type": "result",
      -  "success": true,
      -  "result": null
      -}
      -
      +
      {
      +  "id": 18,
      +  "type": "result",
      +  "success": true,
      +  "result": null
      +}
      +
      +

      For each event that matches, the server will send a message of type event. The id in the message will point at the original id of the listen_event command.

      -
      {
      -   "id": 18,
      -   "type":"event",
      -   "event":{
      -      "data":{
      -         "entity_id":"light.bed_light",
      -         "new_state":{
      -            "entity_id":"light.bed_light",
      -            "last_changed":"2016-11-26T01:37:24.265390+00:00",
      -            "state":"on",
      -            "attributes":{
      -               "rgb_color":[
      -                  254,
      -                  208,
      -                  0
      -               ],
      -               "color_temp":380,
      -               "supported_features":147,
      -               "xy_color":[
      -                  0.5,
      -                  0.5
      -               ],
      -               "brightness":180,
      -               "white_value":200,
      -               "friendly_name":"Bed Light"
      -            },
      -            "last_updated":"2016-11-26T01:37:24.265390+00:00"
      -         },
      -         "old_state":{
      -            "entity_id":"light.bed_light",
      -            "last_changed":"2016-11-26T01:37:10.466994+00:00",
      -            "state":"off",
      -            "attributes":{
      -               "supported_features":147,
      -               "friendly_name":"Bed Light"
      -            },
      -            "last_updated":"2016-11-26T01:37:10.466994+00:00"
      -         }
      -      },
      -      "event_type":"state_changed",
      -      "time_fired":"2016-11-26T01:37:24.265429+00:00",
      -      "origin":"LOCAL"
      -   }
      -}
      -
      +
      {
      +   "id": 18,
      +   "type":"event",
      +   "event":{
      +      "data":{
      +         "entity_id":"light.bed_light",
      +         "new_state":{
      +            "entity_id":"light.bed_light",
      +            "last_changed":"2016-11-26T01:37:24.265390+00:00",
      +            "state":"on",
      +            "attributes":{
      +               "rgb_color":[
      +                  254,
      +                  208,
      +                  0
      +               ],
      +               "color_temp":380,
      +               "supported_features":147,
      +               "xy_color":[
      +                  0.5,
      +                  0.5
      +               ],
      +               "brightness":180,
      +               "white_value":200,
      +               "friendly_name":"Bed Light"
      +            },
      +            "last_updated":"2016-11-26T01:37:24.265390+00:00"
      +         },
      +         "old_state":{
      +            "entity_id":"light.bed_light",
      +            "last_changed":"2016-11-26T01:37:10.466994+00:00",
      +            "state":"off",
      +            "attributes":{
      +               "supported_features":147,
      +               "friendly_name":"Bed Light"
      +            },
      +            "last_updated":"2016-11-26T01:37:10.466994+00:00"
      +         }
      +      },
      +      "event_type":"state_changed",
      +      "time_fired":"2016-11-26T01:37:24.265429+00:00",
      +      "origin":"LOCAL"
      +   }
      +}
      +
      +
      -

      Unsubscribing from events

      +

      Unsubscribing from events

      You can unsubscribe from previously created subscription events. Pass the id of the original subscription command as value to the subscription field.

      -
      {
      -  "id": 19,
      -  "type": "unsubscribe_events",
      -  "subscription": 18
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "unsubscribe_events",
      +  "subscription": 18
      +}
      +
      +

      The server will respond with a result message to indicate that unsubscribing was successful.

      -
      {
      -  "id": 19,
      -  "type": "result",
      -  "success": true,
      -  "result": null
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "result",
      +  "success": true,
      +  "result": null
      +}
      +
      +
      -

      Calling a service

      +

      Calling a service

      This will call a service in Home Assistant. Right now there is no return value. The client can listen to state_changed events if it is interested in changed entities as a result of a service call.

      @@ -303,95 +316,104 @@ b. Server can send results of previous commands.

      The server will indicate with a message indicating that the service is done executing.

      -
      {
      -  "id": 24,
      -  "type": "result",
      -  "success": true,
      -  "result": null
      -}
      -
      +
      {
      +  "id": 24,
      +  "type": "result",
      +  "success": true,
      +  "result": null
      +}
      +
      +
      -

      Fetching states

      +

      Fetching states

      This will get a dump of all the current states in Home Assistant.

      -
      {
      -  "id": 19,
      -  "type": "get_states"
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "get_states"
      +}
      +
      +

      The server will respond with a result message containing the states.

      -
      {
      -  "id": 19,
      -  "type": "result",
      -  "success": true,
      -  "result": [ … ]
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "result",
      +  "success": true,
      +  "result": [ ... ]
      +}
      +
      +
      -

      Fetching config

      +

      Fetching config

      This will get a dump of the current config in Home Assistant.

      -
      {
      -  "id": 19,
      -  "type": "get_config"
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "get_config"
      +}
      +
      +

      The server will respond with a result message containing the config.

      -
      {
      -  "id": 19,
      -  "type": "result",
      -  "success": true,
      -  "result": { … }
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "result",
      +  "success": true,
      +  "result": { ... }
      +}
      +
      +
      -

      Fetching services

      +

      Fetching services

      This will get a dump of the current services in Home Assistant.

      -
      {
      -  "id": 19,
      -  "type": "get_config"
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "get_config"
      +}
      +
      +

      The server will respond with a result message containing the services.

      -
      {
      -  "id": 19,
      -  "type": "result",
      -  "success": true,
      -  "result": { … }
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "result",
      +  "success": true,
      +  "result": { ... }
      +}
      +
      +
      -

      Fetching panels

      +

      Fetching panels

      This will get a dump of the current registered panels in Home Assistant.

      -
      {
      -  "id": 19,
      -  "type": "get_panels"
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "get_panels"
      +}
      +
      +

      The server will respond with a result message containing the current registered panels.

      -
      {
      -  "id": 19,
      -  "type": "result",
      -  "success": true,
      -  "result": [ … ]
      -}
      -
      +
      {
      +  "id": 19,
      +  "type": "result",
      +  "success": true,
      +  "result": [ ... ]
      +}
      +
      +
      -

      Error handling

      +

      Error handling

      If an error occurs, the success key in the result message will be set to false. It will contain an error key containing an object with two keys: code and message.

      @@ -418,16 +440,17 @@ b. Server can send results of previous commands. -
      {
      -   "id": 12,
      -   "type":"result",
      -   "success": false,
      -   "error": {
      -      "code": 2,
      -      "message": "Message incorrectly formatted: expected str for dictionary value @ data['event_type']. Got 100"
      -   }
      -}
      -
      +
      {
      +   "id": 12,
      +   "type":"result",
      +   "success": false,
      +   "error": {
      +      "code": 2,
      +      "message": "Message incorrectly formatted: expected str for dictionary value @ data['event_type']. Got 100"
      +   }
      +}
      +
      +
      diff --git a/sitemap.xml b/sitemap.xml index 58bd2f63df..63cdcdea75 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2705,62 +2705,62 @@ https://home-assistant.io/demo/frontend.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/index.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-event.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-info.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-service.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-state.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-template.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-history.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-iframe.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-logbook.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/demo/panels/ha-panel-map.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/googlef4f3693c209fe788.html -2017-02-02T08:26:18+00:00 +2017-02-02T11:07:11+00:00 https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html -2017-02-02T08:26:19+00:00 +2017-02-02T11:07:12+00:00 https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html -2017-02-02T08:26:19+00:00 +2017-02-02T11:07:12+00:00 https://home-assistant.io/static/mdi-demo.html -2017-02-02T08:26:19+00:00 +2017-02-02T11:07:12+00:00