diff --git a/atom.xml b/atom.xml index 6be7169f09..935c6d4671 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 https://home-assistant.io/ diff --git a/blog/categories/architecture/atom.xml b/blog/categories/architecture/atom.xml index 2e9fd8211b..d06a4072b5 100644 --- a/blog/categories/architecture/atom.xml +++ b/blog/categories/architecture/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: architecture | Home Assistant]]> - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 https://home-assistant.io/ diff --git a/blog/categories/component/atom.xml b/blog/categories/component/atom.xml index b505efb2ca..8b3026eea4 100644 --- a/blog/categories/component/atom.xml +++ b/blog/categories/component/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: component | Home Assistant]]> - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index 432a6da41e..5d69e9f2f8 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: website | Home Assistant]]> - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 https://home-assistant.io/ diff --git a/developers/add_new_platform.html b/developers/add_new_platform.html index e2a34e3fbd..c5af081584 100644 --- a/developers/add_new_platform.html +++ b/developers/add_new_platform.html @@ -130,6 +130,54 @@ Platform logic should not interface directly with the devices but use a third-pa

+

Allowing your platform to be discovered

+ +

Home Assistant has a discovery service running in the background to discover new devices. Whenever a new device is discovered, an SERVICE_DISCOVERED event will be fired with the found service and the information. The discovery component has some knowledge about which components handle which type of services and will ensure those are loaded and listening before firing the SERVICE_DISCOVERED event.

+ +

Add discovery instructions

+ +

Device discovery for Home Assistant has been extracted into an external library called NetDisco. This library is integrated using the discovery component and scans the network in intervals for uPnP and zeroconf/mDNS services.

+ +

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. See the repository for examples of existing discoverables.

+ +

Listening to SERVICE_DISCOVERED events

+ +

From your component, you will have to set up the listening for specific services. Below an example how one would listen for discovered Chromecasts:

+ +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+
from homeassistant.loader import get_component
+
+def setup(hass, config):
+    discovery = get_component('discovery')
+
+    def chromecast_discovered(service, info):
+        """ Called when a Chromecast has been discovered. """
+        print("Discovered a new Chromecast: {}".format(info))
+
+    discovery.listen(
+        hass, discovery.services.GOOGLE_CAST, chromecast_discovered)
+
+ + +

Auto-loading your component upon discovery

+ +

The Discovery component is capable of setting up your components before firing the SERVICE_DISCOVERD event. To do this you will have to update the SERVICE_HANDLERS constant in the discovery component.

+ +

+This option is currently limited to built-in components. +

+ + diff --git a/sitemap.xml b/sitemap.xml index 903b58dd41..ddff8264d4 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -17,67 +17,67 @@ https://home-assistant.io/developers/add_new_platform.html - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/developers/api.html - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/developers/architecture.html - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/developers/creating_components.html - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/developers/frontend.html - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/blog/ - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/blog/archives/ - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/ - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 1.0 https://home-assistant.io/components/ - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/getting-started/ - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7 https://home-assistant.io/developers/ - 2015-01-05T21:03:42-08:00 + 2015-01-10T08:54:35-08:00 weekly 0.7