Site updated at 2015-02-08 23:07:19 UTC
This commit is contained in:
parent
9dda3bb9eb
commit
b80f1706d9
13 changed files with 63 additions and 63 deletions
|
@ -132,17 +132,17 @@ Platform logic should not interface directly with the devices but use a third-pa
|
|||
|
||||
<p><a name='discovery'></a></p>
|
||||
|
||||
<h2>Allowing your platform to be discovered</h2>
|
||||
<h2><a class='title-link' name='allowing-your-platform-to-be-discovered' href='#allowing-your-platform-to-be-discovered'></a> Allowing your platform to be discovered</h2>
|
||||
|
||||
<p>Home Assistant has a discovery service running in the background to discover new devices. Whenever a new device is discovered, an <code>SERVICE_DISCOVERED</code> event will be fired with the found service and the information. The <code>discovery</code> component has some knowledge about which components handle which type of services and will ensure those are loaded and listening before firing the <code>SERVICE_DISCOVERED</code> event.</p>
|
||||
|
||||
<h3>Add discovery instructions</h3>
|
||||
<h3><a class='title-link' name='add-discovery-instructions' href='#add-discovery-instructions'></a> Add discovery instructions</h3>
|
||||
|
||||
<p>Device discovery for Home Assistant has been extracted into an external library called <a href="https://github.com/balloob/netdisco">NetDisco</a>. This library is integrated using <a href="https://github.com/balloob/home-assistant/blob/dev/homeassistant/components/discovery.py">the <code>discovery</code> component</a> and scans the network in intervals for uPnP and zeroconf/mDNS services.</p>
|
||||
|
||||
<p>To have your device be discovered, you will have to extend the NetDisco library to be able to find your device. This is done by adding a new discoverable. <a href="https://github.com/balloob/netdisco/tree/master/netdisco/discoverables">See the repository for examples of existing discoverables.</a></p>
|
||||
|
||||
<h3>Listening to <code>SERVICE_DISCOVERED</code> events</h3>
|
||||
<h3><a class='title-link' name='listening-to-service_discovered-events' href='#listening-to-service_discovered-events'></a> Listening to <code>SERVICE_DISCOVERED</code> events</h3>
|
||||
|
||||
<p>From your component, you will have to set up the listening for specific services. Below an example how one would listen for discovered Chromecasts:</p>
|
||||
|
||||
|
@ -171,7 +171,7 @@ Platform logic should not interface directly with the devices but use a third-pa
|
|||
</span></code></pre></td></tr></table></div></figure>
|
||||
|
||||
|
||||
<h3>Auto-loading your component upon discovery</h3>
|
||||
<h3><a class='title-link' name='auto-loading-your-component-upon-discovery' href='#auto-loading-your-component-upon-discovery'></a> Auto-loading your component upon discovery</h3>
|
||||
|
||||
<p>The Discovery component is capable of setting up your components before firing the <code>SERVICE_DISCOVERD</code> event. To do this you will have to update the <a href="https://github.com/balloob/home-assistant/blob/dev/homeassistant/components/discovery.py#L29"><code>SERVICE_HANDLERS</code></a> constant in <a href="https://github.com/balloob/home-assistant/blob/dev/homeassistant/components/discovery.py">the <code>discovery</code> component</a>.</p>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue