Port netdisco from external to requirements.txt

This commit is contained in:
Paulus Schoutsen 2015-07-20 00:07:01 -07:00
parent 43cc3624ee
commit 3efb1e4ac9
7 changed files with 17 additions and 25 deletions

3
.gitmodules vendored
View file

@ -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

View file

@ -12,9 +12,6 @@ loaded before the EVENT_PLATFORM_DISCOVERED is fired.
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 @@ from homeassistant.const import (
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)

View file

@ -99,7 +99,7 @@ LIGHT_PROFILES_FILE = "light_profiles.csv"
DISCOVERY_PLATFORMS = {
wink.DISCOVER_LIGHTS: 'wink',
isy994.DISCOVER_LIGHTS: 'isy994',
discovery.services.PHILIPS_HUE: 'hue',
discovery.SERVICE_HUE: 'hue',
}
PROP_TO_ATTR = {

View file

@ -24,7 +24,7 @@ SCAN_INTERVAL = 30
ENTITY_ID_FORMAT = DOMAIN + '.{}'
DISCOVERY_PLATFORMS = {
discovery.services.GOOGLE_CAST: 'cast',
discovery.SERVICE_CAST: 'cast',
}
SERVICE_YOUTUBE_VIDEO = 'play_youtube_video'

View file

@ -29,7 +29,7 @@ MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
# 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',
}

@ -1 +0,0 @@
Subproject commit b2cad7c2b959efa8eee9b5ac62d87232bf0b5176

View file

@ -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