diff --git a/.gitmodules b/.gitmodules index b4ab8e17c0a0f8..f33d9430f54ea6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "homeassistant/external/pywemo"] path = homeassistant/external/pywemo url = https://github.com/balloob/pywemo.git -[submodule "homeassistant/external/netdisco"] - path = homeassistant/external/netdisco - url = https://github.com/balloob/netdisco.git [submodule "homeassistant/external/noop"] path = homeassistant/external/noop url = https://github.com/balloob/noop.git diff --git a/homeassistant/components/discovery.py b/homeassistant/components/discovery.py index 63c9a0af74fdf0..0aa7312bfd7267 100644 --- a/homeassistant/components/discovery.py +++ b/homeassistant/components/discovery.py @@ -12,9 +12,6 @@ import logging import threading -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.netdisco.netdisco.const as services - from homeassistant import bootstrap from homeassistant.const import ( EVENT_HOMEASSISTANT_START, EVENT_PLATFORM_DISCOVERED, @@ -22,14 +19,20 @@ DOMAIN = "discovery" DEPENDENCIES = [] -REQUIREMENTS = ['zeroconf>=0.16.0'] +REQUIREMENTS = ['netdisco>=0.1'] SCAN_INTERVAL = 300 # seconds +# Next 3 lines for now a mirror from netdisco.const +# Should setup a mapping netdisco.const -> own constants +SERVICE_WEMO = 'belkin_wemo' +SERVICE_HUE = 'philips_hue' +SERVICE_CAST = 'google_cast' + SERVICE_HANDLERS = { - services.BELKIN_WEMO: "switch", - services.GOOGLE_CAST: "media_player", - services.PHILIPS_HUE: "light", + SERVICE_WEMO: "switch", + SERVICE_CAST: "media_player", + SERVICE_HUE: "light", } @@ -56,14 +59,7 @@ def setup(hass, config): """ Starts a discovery service. """ logger = logging.getLogger(__name__) - try: - from homeassistant.external.netdisco.netdisco.service import \ - DiscoveryService - except ImportError: - logger.exception( - "Unable to import netdisco. " - "Did you install all the zeroconf dependency?") - return False + from netdisco.service import DiscoveryService # Disable zeroconf logging, it spams logging.getLogger('zeroconf').setLevel(logging.CRITICAL) diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 58c3c3cd8f2b45..35e80cc143def7 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -99,7 +99,7 @@ DISCOVERY_PLATFORMS = { wink.DISCOVER_LIGHTS: 'wink', isy994.DISCOVER_LIGHTS: 'isy994', - discovery.services.PHILIPS_HUE: 'hue', + discovery.SERVICE_HUE: 'hue', } PROP_TO_ATTR = { diff --git a/homeassistant/components/media_player/__init__.py b/homeassistant/components/media_player/__init__.py index 0cb4608ba1b5e7..8cd3353bea8bae 100644 --- a/homeassistant/components/media_player/__init__.py +++ b/homeassistant/components/media_player/__init__.py @@ -24,7 +24,7 @@ ENTITY_ID_FORMAT = DOMAIN + '.{}' DISCOVERY_PLATFORMS = { - discovery.services.GOOGLE_CAST: 'cast', + discovery.SERVICE_CAST: 'cast', } SERVICE_YOUTUBE_VIDEO = 'play_youtube_video' diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index 95457b66f5f890..b141c36f7b50c7 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -29,7 +29,7 @@ # Maps discovered services to their platforms DISCOVERY_PLATFORMS = { - discovery.services.BELKIN_WEMO: 'wemo', + discovery.SERVICE_WEMO: 'wemo', wink.DISCOVER_SWITCHES: 'wink', isy994.DISCOVER_SWITCHES: 'isy994', } diff --git a/homeassistant/external/netdisco b/homeassistant/external/netdisco deleted file mode 160000 index b2cad7c2b959ef..00000000000000 --- a/homeassistant/external/netdisco +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b2cad7c2b959efa8eee9b5ac62d87232bf0b5176 diff --git a/requirements.txt b/requirements.txt index f70d755d5d3298..e601614bb965b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,9 +5,6 @@ pytz>=2015.2 # Optional, needed for specific components -# Discovery platform (discovery) -zeroconf>=0.16.0 - # Sun (sun) astral>=0.8.1 @@ -82,3 +79,6 @@ https://github.com/theolind/pymysensors/archive/master.zip#egg=pymysensors-0.1 # Netgear (device_tracker.netgear) pynetgear>=0.1 + +# Netdisco (discovery) +netdisco>=0.1