You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li>Netatmo: <ahref="https://home-assistant.io/components/netatmo/">Netatmo</a> Presence support (<ahref="https://github.com/gieljnssns">@gieljnssns</a>)</li>
146
-
<li>Sensor: <ahref="https://home-assistant.io/components/binary_sensor.arest/">Amcrest</a> camera sensors (<ahref="https://github.com/tchellomello">@tchellomello</a>)</li>
146
+
<li>Sensor: <ahref="https://home-assistant.io/components/binary_sensor.amcrest/">Amcrest</a> camera sensors (<ahref="https://github.com/tchellomello">@tchellomello</a>)</li>
147
147
<li>Notify: New <ahref="https://home-assistant.io/components/notify.discord/">Discord</a> notification component (<ahref="https://github.com/Deinara">@Deinara</a>)</li>
148
148
<li>Device tracker: <ahref="https://home-assistant.io/components/device_tracker.tado/">Tado</a> device tracker support (<ahref="https://github.com/jmvermeulen">@jmvermeulen</a>)</li>
149
149
<li>Sensor: Add <ahref="https://home-assistant.io/components/sensor.skybeacon/">Skybeacon</a> BLE temperature/humidity sensor (<ahref="https://github.com/anpetrov">@anpetrov</a>)</li>
<li>Netatmo: <ahref="https://home-assistant.io/components/netatmo/">Netatmo</a> Presence support (<ahref="https://github.com/gieljnssns">@gieljnssns</a>)</li>
150
-
<li>Sensor: <ahref="https://home-assistant.io/components/binary_sensor.arest/">Amcrest</a> camera sensors (<ahref="https://github.com/tchellomello">@tchellomello</a>)</li>
150
+
<li>Sensor: <ahref="https://home-assistant.io/components/binary_sensor.amcrest/">Amcrest</a> camera sensors (<ahref="https://github.com/tchellomello">@tchellomello</a>)</li>
151
151
<li>Notify: New <ahref="https://home-assistant.io/components/notify.discord/">Discord</a> notification component (<ahref="https://github.com/Deinara">@Deinara</a>)</li>
152
152
<li>Device tracker: <ahref="https://home-assistant.io/components/device_tracker.tado/">Tado</a> device tracker support (<ahref="https://github.com/jmvermeulen">@jmvermeulen</a>)</li>
153
153
<li>Sensor: Add <ahref="https://home-assistant.io/components/sensor.skybeacon/">Skybeacon</a> BLE temperature/humidity sensor (<ahref="https://github.com/anpetrov">@anpetrov</a>)</li>
Copy file name to clipboardExpand all lines: developers/websocket_api/index.html
+14-12
Original file line number
Diff line number
Diff line change
@@ -90,13 +90,15 @@ <h1 class="title indent">
90
90
<hrclass="divider">
91
91
92
92
93
-
<p>Home Assistant contains a websocket API. This API can be used to stream information from the Home Assistant server to any client that implements websockets. Implementations in different languages:</p>
93
+
<p>Home Assistant contains a websocket API. This API can be used to stream information from a Home Assistant instance to any client that implements websockets. Implementations in different languages:</p>
94
94
95
95
<ul>
96
96
<li><ahref="https://github.com/home-assistant/home-assistant-js-websocket">JavaScript</a> - powers the frontend</li>
97
97
</ul>
98
98
99
-
<h1><aclass="title-link" name="server-states" href="#server-states"></a> Server states</h1>
99
+
<p>Connect your websocket implementation to <codeclass="highlighter-rouge">ws://localhost:8123/api/websocket</code>.</p>
100
+
101
+
<h2><aclass="title-link" name="server-states" href="#server-states"></a> Server states</h2>
100
102
101
103
<ol>
102
104
<li>Client connects</li>
@@ -116,7 +118,7 @@ <h1><a class="title-link" name="server-states" href="#server-states"></a> Server
116
118
117
119
<p>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.</p>
<p>Each API message is a JSON serialized object containing a <codeclass="highlighter-rouge">type</code> key. After the authentication phase messages also must contain an <codeclass="highlighter-rouge">id</code>, an integer that contains the number of interactions.</p>
<p>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).</p>
<p>During this phase the client can give commands to the server. The server will respond to each command with a <codeclass="highlighter-rouge">result</code> message indicating when the command is done and if it was successful.</p>
<h2><aclass="title-link" name="unsubscribing-from-events" href="#unsubscribing-from-events"></a> Unsubscribing from events</h2>
280
+
<h3><aclass="title-link" name="unsubscribing-from-events" href="#unsubscribing-from-events"></a> Unsubscribing from events</h3>
279
281
280
282
<p>You can unsubscribe from previously created subscription events. Pass the id of the original subscription command as value to the subscription field.</p>
<h2><aclass="title-link" name="calling-a-service" href="#calling-a-service"></a> Calling a service</h2>
303
+
<h3><aclass="title-link" name="calling-a-service" href="#calling-a-service"></a> Calling a service</h3>
302
304
303
305
<p>This will call a service in Home Assistant. Right now there is no return value. The client can listen to <codeclass="highlighter-rouge">state_changed</code> events if it is interested in changed entities as a result of a service call.</p>
<p>If an error occurs, the <codeclass="highlighter-rouge">success</code> key in the <codeclass="highlighter-rouge">result</code> message will be set to <codeclass="highlighter-rouge">false</code>. It will contain an <codeclass="highlighter-rouge">error</code> key containing an object with two keys: <codeclass="highlighter-rouge">code</code> and <codeclass="highlighter-rouge">message</code>.</p>
0 commit comments