diff --git a/.gitmodules b/.gitmodules index ca0b1f024b8..a627e522d8f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,24 +1,12 @@ -[submodule "homeassistant/external/pynetgear"] - path = homeassistant/external/pynetgear - url = https://github.com/balloob/pynetgear.git -[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 -[submodule "homeassistant/components/frontend/www_static/polymer/home-assistant-js"] - path = homeassistant/components/frontend/www_static/polymer/home-assistant-js - url = https://github.com/balloob/home-assistant-js.git [submodule "homeassistant/external/vera"] path = homeassistant/external/vera url = https://github.com/jamespcole/home-assistant-vera-api.git [submodule "homeassistant/external/nzbclients"] path = homeassistant/external/nzbclients url = https://github.com/jamespcole/home-assistant-nzb-clients.git -[submodule "homeassistant/external/pymysensors"] - path = homeassistant/external/pymysensors - url = https://github.com/theolind/pymysensors +[submodule "homeassistant/components/frontend/www_static/home-assistant-polymer"] + path = homeassistant/components/frontend/www_static/home-assistant-polymer + url = https://github.com/balloob/home-assistant-polymer.git diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 0a575afede0..2514b35587f 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -5,8 +5,11 @@ import sys import os import argparse import subprocess +import importlib DEPENDENCIES = ['requests>=2.0', 'pyyaml>=3.11', 'pytz>=2015.2'] +IS_VIRTUAL = (getattr(sys, 'base_prefix', sys.prefix) != sys.prefix or + hasattr(sys, 'real_prefix')) def validate_python(): @@ -18,18 +21,33 @@ def validate_python(): sys.exit() +def ensure_pip(): + """ Validate pip is installed so we can install packages on demand. """ + if importlib.find_loader('pip') is None: + print("Your Python installation did not bundle 'pip'") + print("Home Assistant requires 'pip' to be installed.") + print("Please install pip: " + "https://pip.pypa.io/en/latest/installing.html") + sys.exit() + + # Copy of homeassistant.util.package because we can't import yet def install_package(package): """Install a package on PyPi. Accepts pip compatible package strings. Return boolean if install successfull.""" - args = ['python3', '-m', 'pip', 'install', '--quiet', package] - if sys.base_prefix == sys.prefix: + args = [sys.executable, '-m', 'pip', 'install', '--quiet', package] + if not IS_VIRTUAL: args.append('--user') - return not subprocess.call(args) + try: + return 0 == subprocess.call(args) + except subprocess.SubprocessError: + return False def validate_dependencies(): """ Validate all dependencies that HA uses. """ + ensure_pip() + print("Validating dependencies...") import_fail = False @@ -118,6 +136,9 @@ def main(): validate_python() validate_dependencies() + # Windows needs this to pick up new modules + importlib.invalidate_caches() + bootstrap = ensure_path_and_load_bootstrap() validate_git_submodules() @@ -128,11 +149,10 @@ def main(): config_path = ensure_config_path(config_dir) if args.demo_mode: - from homeassistant.components import http, demo + from homeassistant.components import frontend, demo - # Demo mode only requires http and demo components. hass = bootstrap.from_config_dict({ - http.DOMAIN: {}, + frontend.DOMAIN: {}, demo.DOMAIN: {} }) else: diff --git a/homeassistant/components/device_tracker/netgear.py b/homeassistant/components/device_tracker/netgear.py index 102bc78ff47..3fe11f99fe6 100644 --- a/homeassistant/components/device_tracker/netgear.py +++ b/homeassistant/components/device_tracker/netgear.py @@ -43,6 +43,7 @@ from homeassistant.components.device_tracker import DOMAIN MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5) _LOGGER = logging.getLogger(__name__) +REQUIREMENTS = ['pynetgear>=0.1'] def get_scanner(hass, config): @@ -64,22 +65,10 @@ class NetgearDeviceScanner(object): """ This class queries a Netgear wireless router using the SOAP-API. """ def __init__(self, host, username, password): + import pynetgear + self.last_results = [] - try: - # Pylint does not play nice if not every folders has an __init__.py - # pylint: disable=no-name-in-module, import-error - import homeassistant.external.pynetgear.pynetgear as pynetgear - except ImportError: - _LOGGER.exception( - ("Failed to import pynetgear. " - "Did you maybe not run `git submodule init` " - "and `git submodule update`?")) - - self.success_init = False - - return - self._api = pynetgear.Netgear(host, username, password) self.lock = threading.Lock() diff --git a/homeassistant/components/discovery.py b/homeassistant/components/discovery.py index 63c9a0af74f..0aa7312bfd7 100644 --- a/homeassistant/components/discovery.py +++ b/homeassistant/components/discovery.py @@ -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) diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 2892e278c5c..902b14e38b3 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -55,7 +55,7 @@ def _handle_get_root(handler, path_match, data): handler.end_headers() if handler.server.development: - app_url = "polymer/home-assistant.html" + app_url = "home-assistant-polymer/src/home-assistant.html" else: app_url = "frontend-{}.html".format(version.VERSION) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 0c1938ae74d..6f30746f137 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_frontend script """ -VERSION = "85f0078ea394a12dd95395799e345c83" +VERSION = "ccfe7497d635ab4df3e6943b05adbd9b" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index 1c0506bd83c..c8cabd1b0a3 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -1,5964 +1,6 @@ -
- - - - - - - - - - - - - - - - - - + @-webkit-keyframes ha-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } + } + @keyframes ha-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } + } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- It looks like we have nothing to show you right now. It could be that we have not yet discovered all your devices but it is more likely that you have not configured Home Assistant yet. -
-- Please see the Getting Started section on how to setup your devices. -
-It looks like we have nothing to show you right now. It could be that we have not yet discovered all your devices but it is more likely that you have not configured Home Assistant yet.
Please see the Getting Started section on how to setup your devices.
- It looks like we have nothing to show you right now. It could be that we have not yet discovered all your devices but it is more likely that you have not configured Home Assistant yet. -
-- Please see the Getting Started section on how to setup your devices. -
-It looks like we have nothing to show you right now. It could be that we have not yet discovered all your devices but it is more likely that you have not configured Home Assistant yet.
Please see the Getting Started section on how to setup your devices.
- Call a service from a component. -
- -Call a service from a component.
- Fire an event on the event bus. -
- -Fire an event on the event bus.
[[stateObj.attributes.description]]
- -[[stateObj.attributes.errors]]
- -
-
-
-
[[stateObj.attributes.description]]
[[stateObj.attributes.errors]]