From 892573e53ed2db6d619730fd5f25c74bd817fd4a Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 23 Jun 2015 12:34:55 +0200 Subject: [PATCH 01/32] remove unused stuff and update the names (same as in owm sensor) --- homeassistant/components/sensor/forecast.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/sensor/forecast.py b/homeassistant/components/sensor/forecast.py index 98e088d5139..bcc5cd3b050 100644 --- a/homeassistant/components/sensor/forecast.py +++ b/homeassistant/components/sensor/forecast.py @@ -1,7 +1,6 @@ """ homeassistant.components.sensor.forecast ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Forecast.io service. Configuration: @@ -113,10 +112,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # pylint: disable=too-few-public-methods class ForeCastSensor(Entity): - """ Implements an OpenWeatherMap sensor. """ + """ Implements an Forecast.io sensor. """ def __init__(self, weather_data, sensor_type, unit): - self.client_name = 'Forecast' + self.client_name = 'Weather' self._name = SENSOR_TYPES[sensor_type][0] self.forecast_client = weather_data self._unit = unit @@ -127,7 +126,7 @@ class ForeCastSensor(Entity): @property def name(self): - return '{} - {}'.format(self.client_name, self._name) + return '{} {}'.format(self.client_name, self._name) @property def state(self): @@ -149,10 +148,6 @@ class ForeCastSensor(Entity): try: if self.type == 'summary': self._state = data.summary - # elif self.type == 'sunrise_time': - # self._state = data.sunriseTime - # elif self.type == 'sunset_time': - # self._state = data.sunsetTime elif self.type == 'precip_intensity': if data.precipIntensity == 0: self._state = 'None' From db5060b32374c24cbe6e41b7405a16166fde0ecf Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 23 Jun 2015 12:34:55 +0200 Subject: [PATCH 02/32] remove unused stuff and update the names (same as in owm sensor) --- homeassistant/components/sensor/forecast.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/sensor/forecast.py b/homeassistant/components/sensor/forecast.py index 98e088d5139..bcc5cd3b050 100644 --- a/homeassistant/components/sensor/forecast.py +++ b/homeassistant/components/sensor/forecast.py @@ -1,7 +1,6 @@ """ homeassistant.components.sensor.forecast ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Forecast.io service. Configuration: @@ -113,10 +112,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # pylint: disable=too-few-public-methods class ForeCastSensor(Entity): - """ Implements an OpenWeatherMap sensor. """ + """ Implements an Forecast.io sensor. """ def __init__(self, weather_data, sensor_type, unit): - self.client_name = 'Forecast' + self.client_name = 'Weather' self._name = SENSOR_TYPES[sensor_type][0] self.forecast_client = weather_data self._unit = unit @@ -127,7 +126,7 @@ class ForeCastSensor(Entity): @property def name(self): - return '{} - {}'.format(self.client_name, self._name) + return '{} {}'.format(self.client_name, self._name) @property def state(self): @@ -149,10 +148,6 @@ class ForeCastSensor(Entity): try: if self.type == 'summary': self._state = data.summary - # elif self.type == 'sunrise_time': - # self._state = data.sunriseTime - # elif self.type == 'sunset_time': - # self._state = data.sunsetTime elif self.type == 'precip_intensity': if data.precipIntensity == 0: self._state = 'None' From a34742040c5622216c01797307cd8db2a710b0fe Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 23 Jun 2015 12:34:55 +0200 Subject: [PATCH 03/32] remove unused stuff and update the names (same as in owm sensor) --- homeassistant/components/sensor/forecast.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/sensor/forecast.py b/homeassistant/components/sensor/forecast.py index 98e088d5139..bcc5cd3b050 100644 --- a/homeassistant/components/sensor/forecast.py +++ b/homeassistant/components/sensor/forecast.py @@ -1,7 +1,6 @@ """ homeassistant.components.sensor.forecast ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Forecast.io service. Configuration: @@ -113,10 +112,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # pylint: disable=too-few-public-methods class ForeCastSensor(Entity): - """ Implements an OpenWeatherMap sensor. """ + """ Implements an Forecast.io sensor. """ def __init__(self, weather_data, sensor_type, unit): - self.client_name = 'Forecast' + self.client_name = 'Weather' self._name = SENSOR_TYPES[sensor_type][0] self.forecast_client = weather_data self._unit = unit @@ -127,7 +126,7 @@ class ForeCastSensor(Entity): @property def name(self): - return '{} - {}'.format(self.client_name, self._name) + return '{} {}'.format(self.client_name, self._name) @property def state(self): @@ -149,10 +148,6 @@ class ForeCastSensor(Entity): try: if self.type == 'summary': self._state = data.summary - # elif self.type == 'sunrise_time': - # self._state = data.sunriseTime - # elif self.type == 'sunset_time': - # self._state = data.sunsetTime elif self.type == 'precip_intensity': if data.precipIntensity == 0: self._state = 'None' From 7fcdb9b97586158e76ec408b0a31e3d1ea8dbfab Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Sun, 12 Jul 2015 18:44:38 -0400 Subject: [PATCH 04/32] Updating Debian daemon script for Python Virtual Environments Fix to init.d script that forces the correct virtual environment to be loaded. --- scripts/homeassistant.daemon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/homeassistant.daemon b/scripts/homeassistant.daemon index 4c504557dec..bef4cd90f4a 100755 --- a/scripts/homeassistant.daemon +++ b/scripts/homeassistant.daemon @@ -12,7 +12,7 @@ # Created with: https://gist.github.com/naholyr/4275302#file-new-service-sh # # Installation: -# 1) Populate RUNAS and RUNDIR folders +# 1) Populate RUNAS and RUNDIR variables # 2) Create Log -- sudo touch /var/log/homeassistant.log # 3) Set Log Ownership -- sudo chown USER:GROUP /var/log/homeassistant.log # 4) Create PID File -- sudo touch /var/run/homeassistant.pid @@ -29,7 +29,7 @@ # If you are not, the SCRIPT variable must be modified to point to the correct # Python environment. -SCRIPT="./bin/python -m homeassistant" +SCRIPT="source bin/activate; ./bin/python -m homeassistant" RUNAS= RUNDIR= PIDFILE=/var/run/homeassistant.pid From c861622748b1a42ffa8b0bb40433d3bcc4e40a1d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 12 Jul 2015 20:43:07 -0700 Subject: [PATCH 05/32] Extract frontend code into own repository --- .gitmodules | 6 +- homeassistant/components/frontend/__init__.py | 2 +- homeassistant/components/frontend/version.py | 2 +- .../frontend/www_static/frontend.html | 21348 +--------------- .../www_static/home-assistant-polymer | 1 + .../frontend/www_static/polymer/bower.json | 46 - .../cards/state-card-configurator.html | 29 - .../polymer/cards/state-card-content.html | 50 - .../polymer/cards/state-card-display.html | 36 - .../cards/state-card-media_player.html | 91 - .../polymer/cards/state-card-scene.html | 39 - .../polymer/cards/state-card-thermostat.html | 57 - .../polymer/cards/state-card-toggle.html | 95 - .../www_static/polymer/cards/state-card.html | 55 - .../polymer/components/display-time.html | 25 - .../polymer/components/domain-icon.html | 37 - .../polymer/components/entity-list.html | 58 - .../polymer/components/events-list.html | 61 - .../polymer/components/ha-color-picker.html | 169 - .../polymer/components/ha-logbook.html | 39 - .../polymer/components/ha-sidebar.html | 247 - .../components/ha-voice-command-progress.html | 61 - .../polymer/components/loading-box.html | 27 - .../polymer/components/logbook-entry.html | 69 - .../components/relative-ha-datetime.html | 74 - .../polymer/components/services-list.html | 71 - .../polymer/components/state-badge.html | 105 - .../polymer/components/state-cards.html | 80 - .../components/state-history-chart-line.html | 198 - .../state-history-chart-timeline.html | 120 - .../components/state-history-charts.html | 158 - .../polymer/components/state-info.html | 75 - .../polymer/components/stream-status.html | 54 - .../polymer/dialogs/more-info-dialog.html | 151 - .../www_static/polymer/home-assistant-js | 1 - .../www_static/polymer/home-assistant.html | 78 - .../www_static/polymer/html-minifier.conf | 11 - .../polymer/layouts/home-assistant-main.html | 131 - .../polymer/layouts/login-form.html | 160 - .../polymer/layouts/partial-base.html | 48 - .../layouts/partial-dev-call-service.html | 101 - .../layouts/partial-dev-fire-event.html | 91 - .../layouts/partial-dev-set-state.html | 115 - .../polymer/layouts/partial-history.html | 116 - .../polymer/layouts/partial-logbook.html | 119 - .../polymer/layouts/partial-states.html | 185 - .../managers/notification-manager.html | 40 - .../polymer/managers/preferences-manager.html | 40 - .../polymer/more-infos/more-info-camera.html | 52 - .../more-infos/more-info-configurator.html | 125 - .../polymer/more-infos/more-info-content.html | 81 - .../polymer/more-infos/more-info-default.html | 49 - .../polymer/more-infos/more-info-group.html | 63 - .../polymer/more-infos/more-info-light.html | 111 - .../more-infos/more-info-media_player.html | 210 - .../polymer/more-infos/more-info-script.html | 26 - .../polymer/more-infos/more-info-sun.html | 71 - .../more-infos/more-info-thermostat.html | 129 - .../resources/home-assistant-icons.html | 91 - .../polymer/resources/home-assistant-js.html | 54 - .../resources/home-assistant-style.html | 46 - .../www_static/polymer/resources/lodash.html | 5 - .../polymer/resources/moment-js.html | 20 - .../polymer/resources/pikaday-js.html | 2 - .../resources/store-listener-behavior.html | 42 - .../components/frontend/www_static/version.py | 2 + scripts/build_frontend | 21 +- 67 files changed, 146 insertions(+), 26026 deletions(-) create mode 160000 homeassistant/components/frontend/www_static/home-assistant-polymer delete mode 100644 homeassistant/components/frontend/www_static/polymer/bower.json delete mode 100644 homeassistant/components/frontend/www_static/polymer/cards/state-card-configurator.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/cards/state-card-content.html delete mode 100755 homeassistant/components/frontend/www_static/polymer/cards/state-card-display.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/cards/state-card-media_player.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/cards/state-card-scene.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/cards/state-card-thermostat.html delete mode 100755 homeassistant/components/frontend/www_static/polymer/cards/state-card-toggle.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/cards/state-card.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/display-time.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/domain-icon.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/entity-list.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/events-list.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/ha-color-picker.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/ha-logbook.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/ha-sidebar.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/ha-voice-command-progress.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/loading-box.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/logbook-entry.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/relative-ha-datetime.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/services-list.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/state-badge.html delete mode 100755 homeassistant/components/frontend/www_static/polymer/components/state-cards.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/state-history-chart-line.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/state-history-chart-timeline.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/state-history-charts.html delete mode 100755 homeassistant/components/frontend/www_static/polymer/components/state-info.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/components/stream-status.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/dialogs/more-info-dialog.html delete mode 160000 homeassistant/components/frontend/www_static/polymer/home-assistant-js delete mode 100644 homeassistant/components/frontend/www_static/polymer/home-assistant.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/html-minifier.conf delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/login-form.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/partial-base.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-call-service.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-fire-event.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-set-state.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/partial-history.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/partial-logbook.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/layouts/partial-states.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/managers/notification-manager.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/managers/preferences-manager.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-camera.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-configurator.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-content.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-default.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-group.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-light.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-media_player.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-script.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-sun.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-thermostat.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/resources/home-assistant-icons.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/resources/home-assistant-js.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/resources/home-assistant-style.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/resources/lodash.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/resources/moment-js.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/resources/pikaday-js.html delete mode 100644 homeassistant/components/frontend/www_static/polymer/resources/store-listener-behavior.html create mode 100644 homeassistant/components/frontend/www_static/version.py diff --git a/.gitmodules b/.gitmodules index ca0b1f024b8..174bba680f0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,9 +10,6 @@ [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 @@ -22,3 +19,6 @@ [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/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..ca1befe0d97 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 = "2089a352a5f72b7d656e8d04f63f0342" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index 1c0506bd83c..affea62d171 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); + } + } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + } \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer new file mode 160000 index 00000000000..8e143c2e446 --- /dev/null +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -0,0 +1 @@ +Subproject commit 8e143c2e4461771a51cdead553b7fa9e5bbdf772 diff --git a/homeassistant/components/frontend/www_static/polymer/bower.json b/homeassistant/components/frontend/www_static/polymer/bower.json deleted file mode 100644 index 093fed11a46..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/bower.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "Home Assistant", - "version": "0.1.0", - "authors": [ - "Paulus Schoutsen " - ], - "main": "splash-login.html", - "license": "MIT", - "private": true, - "ignore": [ - "bower_components" - ], - "devDependencies": { - "polymer": "Polymer/polymer#^1.0.0", - "webcomponentsjs": "Polymer/webcomponentsjs#^0.7", - "paper-header-panel": "PolymerElements/paper-header-panel#^1.0.0", - "paper-toolbar": "PolymerElements/paper-toolbar#^1.0.0", - "paper-menu": "PolymerElements/paper-menu#^1.0.0", - "iron-input": "PolymerElements/iron-input#^1.0.0", - "iron-icons": "PolymerElements/iron-icons#^1.0.0", - "iron-image": "PolymerElements/iron-image#^1.0.0", - "paper-toast": "PolymerElements/paper-toast#^1.0.0", - "paper-dialog": "PolymerElements/paper-dialog#^1.0.0", - "paper-dialog-scrollable": "polymerelements/paper-dialog-scrollable#^1.0.0", - "paper-spinner": "PolymerElements/paper-spinner#^1.0.0", - "paper-button": "PolymerElements/paper-button#^1.0.0", - "paper-input": "PolymerElements/paper-input#^1.0.0", - "paper-toggle-button": "PolymerElements/paper-toggle-button#^1.0.0", - "paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0", - "paper-item": "PolymerElements/paper-item#^1.0.0", - "paper-slider": "PolymerElements/paper-slider#^1.0.0", - "paper-checkbox": "PolymerElements/paper-checkbox#^1.0.0", - "paper-drawer-panel": "PolymerElements/paper-drawer-panel#^1.0.0", - "paper-scroll-header-panel": "polymerelements/paper-scroll-header-panel#^1.0.0", - "google-apis": "GoogleWebComponents/google-apis#0.8-preview", - "moment": "^2.10.3", - "layout": "Polymer/layout", - "paper-styles": "polymerelements/paper-styles#^1.0.0", - "lodash": "~3.9.3", - "pikaday": "~1.3.2" - }, - "resolutions": { - "polymer": "^1.0.0", - "webcomponentsjs": "^0.7.0" - } -} diff --git a/homeassistant/components/frontend/www_static/polymer/cards/state-card-configurator.html b/homeassistant/components/frontend/www_static/polymer/cards/state-card-configurator.html deleted file mode 100644 index 6a25d41f945..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/cards/state-card-configurator.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/cards/state-card-content.html b/homeassistant/components/frontend/www_static/polymer/cards/state-card-content.html deleted file mode 100644 index e5b929b0804..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/cards/state-card-content.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/cards/state-card-display.html b/homeassistant/components/frontend/www_static/polymer/cards/state-card-display.html deleted file mode 100755 index a40979dcb66..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/cards/state-card-display.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/cards/state-card-media_player.html b/homeassistant/components/frontend/www_static/polymer/cards/state-card-media_player.html deleted file mode 100644 index ab26365c298..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/cards/state-card-media_player.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/cards/state-card-scene.html b/homeassistant/components/frontend/www_static/polymer/cards/state-card-scene.html deleted file mode 100644 index cf7cc9a0c08..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/cards/state-card-scene.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/polymer/cards/state-card-thermostat.html b/homeassistant/components/frontend/www_static/polymer/cards/state-card-thermostat.html deleted file mode 100644 index a86ad51f446..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/cards/state-card-thermostat.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/cards/state-card-toggle.html b/homeassistant/components/frontend/www_static/polymer/cards/state-card-toggle.html deleted file mode 100755 index 51bbcc6fb6e..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/cards/state-card-toggle.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/cards/state-card.html b/homeassistant/components/frontend/www_static/polymer/cards/state-card.html deleted file mode 100644 index 6a21706da74..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/cards/state-card.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/display-time.html b/homeassistant/components/frontend/www_static/polymer/components/display-time.html deleted file mode 100644 index f6908c8a7ff..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/display-time.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/domain-icon.html b/homeassistant/components/frontend/www_static/polymer/components/domain-icon.html deleted file mode 100644 index d9fe55538d4..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/domain-icon.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/entity-list.html b/homeassistant/components/frontend/www_static/polymer/components/entity-list.html deleted file mode 100644 index 8312e0bff09..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/entity-list.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/events-list.html b/homeassistant/components/frontend/www_static/polymer/components/events-list.html deleted file mode 100644 index 5c37d32ecc9..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/events-list.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/ha-color-picker.html b/homeassistant/components/frontend/www_static/polymer/components/ha-color-picker.html deleted file mode 100644 index 46ced3ddf64..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/ha-color-picker.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/ha-logbook.html b/homeassistant/components/frontend/www_static/polymer/components/ha-logbook.html deleted file mode 100644 index a2f2fb00d9b..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/ha-logbook.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/ha-sidebar.html b/homeassistant/components/frontend/www_static/polymer/components/ha-sidebar.html deleted file mode 100644 index 8746ee126c8..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/ha-sidebar.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/ha-voice-command-progress.html b/homeassistant/components/frontend/www_static/polymer/components/ha-voice-command-progress.html deleted file mode 100644 index 44d29a0151c..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/ha-voice-command-progress.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/loading-box.html b/homeassistant/components/frontend/www_static/polymer/components/loading-box.html deleted file mode 100644 index c78fd91122c..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/loading-box.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/logbook-entry.html b/homeassistant/components/frontend/www_static/polymer/components/logbook-entry.html deleted file mode 100644 index 3575d6b5d94..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/logbook-entry.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/relative-ha-datetime.html b/homeassistant/components/frontend/www_static/polymer/components/relative-ha-datetime.html deleted file mode 100644 index 2017dd874f6..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/relative-ha-datetime.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/services-list.html b/homeassistant/components/frontend/www_static/polymer/components/services-list.html deleted file mode 100644 index 146703f1042..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/services-list.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/state-badge.html b/homeassistant/components/frontend/www_static/polymer/components/state-badge.html deleted file mode 100644 index 7b015b20786..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/state-badge.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/state-cards.html b/homeassistant/components/frontend/www_static/polymer/components/state-cards.html deleted file mode 100755 index 5eabf370e01..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/state-cards.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/state-history-chart-line.html b/homeassistant/components/frontend/www_static/polymer/components/state-history-chart-line.html deleted file mode 100644 index a45d6b3c3ec..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/state-history-chart-line.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/state-history-chart-timeline.html b/homeassistant/components/frontend/www_static/polymer/components/state-history-chart-timeline.html deleted file mode 100644 index 6e45cd264ed..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/state-history-chart-timeline.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/state-history-charts.html b/homeassistant/components/frontend/www_static/polymer/components/state-history-charts.html deleted file mode 100644 index 17a93fcabc1..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/state-history-charts.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/state-info.html b/homeassistant/components/frontend/www_static/polymer/components/state-info.html deleted file mode 100755 index 50b10fa91a9..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/state-info.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/components/stream-status.html b/homeassistant/components/frontend/www_static/polymer/components/stream-status.html deleted file mode 100644 index 47118ed9f9a..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/components/stream-status.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/dialogs/more-info-dialog.html b/homeassistant/components/frontend/www_static/polymer/dialogs/more-info-dialog.html deleted file mode 100644 index 6a1ac77133d..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/dialogs/more-info-dialog.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/home-assistant-js b/homeassistant/components/frontend/www_static/polymer/home-assistant-js deleted file mode 160000 index 94d8682c1e7..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/home-assistant-js +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 94d8682c1e7679ae744e8419896d5d7b0bdd16cc diff --git a/homeassistant/components/frontend/www_static/polymer/home-assistant.html b/homeassistant/components/frontend/www_static/polymer/home-assistant.html deleted file mode 100644 index 8c4ed824cdd..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/home-assistant.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/html-minifier.conf b/homeassistant/components/frontend/www_static/polymer/html-minifier.conf deleted file mode 100644 index 2e6dbb9538b..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/html-minifier.conf +++ /dev/null @@ -1,11 +0,0 @@ -{ - "removeComments": true, - "removeCommentsFromCDATA": true, - "removeCDATASectionsFromCDATA": true, - "collapseWhitespace": true, - "collapseBooleanAttributes": true, - "removeScriptTypeAttributes": true, - "removeStyleLinkTypeAttributes": true, - "minifyJS": true, - "minifyCSS": true -} diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html b/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html deleted file mode 100644 index a1e6fe9b2f5..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/login-form.html b/homeassistant/components/frontend/www_static/polymer/layouts/login-form.html deleted file mode 100644 index 43b1e97590c..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/login-form.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/partial-base.html b/homeassistant/components/frontend/www_static/polymer/layouts/partial-base.html deleted file mode 100644 index 3e1e5cc57fc..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/partial-base.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-call-service.html b/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-call-service.html deleted file mode 100644 index f3ae78d3953..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-call-service.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-fire-event.html b/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-fire-event.html deleted file mode 100644 index 57cc3ef5da4..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-fire-event.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-set-state.html b/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-set-state.html deleted file mode 100644 index 6771bbdb1ba..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/partial-dev-set-state.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/partial-history.html b/homeassistant/components/frontend/www_static/polymer/layouts/partial-history.html deleted file mode 100644 index 9abc0ad096c..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/partial-history.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/partial-logbook.html b/homeassistant/components/frontend/www_static/polymer/layouts/partial-logbook.html deleted file mode 100644 index a6fc0f615d8..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/partial-logbook.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/partial-states.html b/homeassistant/components/frontend/www_static/polymer/layouts/partial-states.html deleted file mode 100644 index ed40a218a89..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/layouts/partial-states.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/managers/notification-manager.html b/homeassistant/components/frontend/www_static/polymer/managers/notification-manager.html deleted file mode 100644 index 0d38e087ebd..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/managers/notification-manager.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/managers/preferences-manager.html b/homeassistant/components/frontend/www_static/polymer/managers/preferences-manager.html deleted file mode 100644 index a70f8070d69..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/managers/preferences-manager.html +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-camera.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-camera.html deleted file mode 100644 index 92d5f1b509d..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-camera.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-configurator.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-configurator.html deleted file mode 100644 index 3309ff91cd9..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-configurator.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-content.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-content.html deleted file mode 100644 index 1c5919e281c..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-content.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-default.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-default.html deleted file mode 100644 index a1b2cde666d..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-default.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-group.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-group.html deleted file mode 100644 index 29b0445de2b..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-group.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-light.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-light.html deleted file mode 100644 index 702eb5fd354..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-light.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-media_player.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-media_player.html deleted file mode 100644 index 1553ee5f1b1..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-media_player.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-script.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-script.html deleted file mode 100644 index bebe8753290..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-script.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-sun.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-sun.html deleted file mode 100644 index bc1f7211469..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-sun.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-thermostat.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-thermostat.html deleted file mode 100644 index 444935e2c83..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-thermostat.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-icons.html b/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-icons.html deleted file mode 100644 index 3ab36597214..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-icons.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-js.html b/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-js.html deleted file mode 100644 index d63ab0333cf..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-js.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-style.html b/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-style.html deleted file mode 100644 index 473e3445d64..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-style.html +++ /dev/null @@ -1,46 +0,0 @@ - - - diff --git a/homeassistant/components/frontend/www_static/polymer/resources/lodash.html b/homeassistant/components/frontend/www_static/polymer/resources/lodash.html deleted file mode 100644 index 54a43c19590..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/resources/lodash.html +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/homeassistant/components/frontend/www_static/polymer/resources/moment-js.html b/homeassistant/components/frontend/www_static/polymer/resources/moment-js.html deleted file mode 100644 index 30b71031163..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/resources/moment-js.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/homeassistant/components/frontend/www_static/polymer/resources/pikaday-js.html b/homeassistant/components/frontend/www_static/polymer/resources/pikaday-js.html deleted file mode 100644 index b8ca382dba0..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/resources/pikaday-js.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/homeassistant/components/frontend/www_static/polymer/resources/store-listener-behavior.html b/homeassistant/components/frontend/www_static/polymer/resources/store-listener-behavior.html deleted file mode 100644 index 7ad23230a4e..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/resources/store-listener-behavior.html +++ /dev/null @@ -1,42 +0,0 @@ - diff --git a/homeassistant/components/frontend/www_static/version.py b/homeassistant/components/frontend/www_static/version.py new file mode 100644 index 00000000000..0f9641f054b --- /dev/null +++ b/homeassistant/components/frontend/www_static/version.py @@ -0,0 +1,2 @@ +""" DO NOT MODIFY. Auto-generated by build_frontend script """ +VERSION = "" diff --git a/scripts/build_frontend b/scripts/build_frontend index 2bf80d28541..3b8349a295a 100755 --- a/scripts/build_frontend +++ b/scripts/build_frontend @@ -6,24 +6,15 @@ if [ ${PWD##*/} == "scripts" ]; then cd .. fi -scripts/build_js $1 +cd homeassistant/components/frontend/www_static/home-assistant-polymer +npm install +npm run frontend_prod -# To build the frontend, you need node, bower, vulcanize and html-minifier -# npm install -g bower vulcanize html-minifier - -# Install dependencies -cd homeassistant/components/frontend/www_static/polymer -bower install -cd .. -cp polymer/bower_components/webcomponentsjs/webcomponents-lite.min.js . - -vulcanize --inline-css --inline-scripts --strip-comments polymer/home-assistant.html > frontend.html - -# html-minifier crashes on frontend, minimize kills the CSS -# html-minifier --config-file polymer/html-minifier.conf -o frontend.html frontend.html +cp bower_components/webcomponentsjs/webcomponents-lite.min.js .. +cp build/frontend.html .. # Generate the MD5 hash of the new frontend -cd .. +cd ../.. echo '""" DO NOT MODIFY. Auto-generated by build_frontend script """' > version.py if [ $(command -v md5) ]; then echo 'VERSION = "'`md5 -q www_static/frontend.html`'"' >> version.py From 87961c1c53c72741e5a75784752bdc27177da93d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 12 Jul 2015 21:08:25 -0700 Subject: [PATCH 06/32] Remove old dev scripts --- scripts/build_js | 17 ----------------- scripts/dev_js | 11 ----------- 2 files changed, 28 deletions(-) delete mode 100755 scripts/build_js delete mode 100755 scripts/dev_js diff --git a/scripts/build_js b/scripts/build_js deleted file mode 100755 index a75b48f9bf9..00000000000 --- a/scripts/build_js +++ /dev/null @@ -1,17 +0,0 @@ -# Builds the JS for production - -# If current pwd is scripts, go 1 up. -if [ ${PWD##*/} == "scripts" ]; then - cd .. -fi - -cd homeassistant/components/frontend/www_static/polymer/home-assistant-js - -npm install - -if [ "$1" = "demo" ]; then - echo "Building a demo mode build!" - npm run demo -else - npm run prod -fi diff --git a/scripts/dev_js b/scripts/dev_js deleted file mode 100755 index a62f0d85ef3..00000000000 --- a/scripts/dev_js +++ /dev/null @@ -1,11 +0,0 @@ -# Builds the JS for developing, rebuilds when files change - -# If current pwd is scripts, go 1 up. -if [ ${PWD##*/} == "scripts" ]; then - cd .. -fi - -cd homeassistant/components/frontend/www_static/polymer/home-assistant-js - -npm install -npm run dev From 0bf45653e3213757d8407a42b6baec90804956e9 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 12 Jul 2015 21:08:39 -0700 Subject: [PATCH 07/32] Upgrade to new version frontend --- homeassistant/components/frontend/version.py | 2 +- .../components/frontend/www_static/frontend.html | 16 ++++++++-------- .../frontend/www_static/home-assistant-polymer | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index ca1befe0d97..e8c139330ce 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 = "2089a352a5f72b7d656e8d04f63f0342" +VERSION = "8716796b65ea358f91338b572d33f07f" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index affea62d171..22d52ebe532 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -4835,11 +4835,11 @@ paper-ripple { font-weight: 300; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; - } \ No newline at end of file + } \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer index 8e143c2e446..813268fcf81 160000 --- a/homeassistant/components/frontend/www_static/home-assistant-polymer +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -1 +1 @@ -Subproject commit 8e143c2e4461771a51cdead553b7fa9e5bbdf772 +Subproject commit 813268fcf8111685d908f23ee81dae3699450385 From d3a6190044a5f6a7276ef85ea8b9e2637d6fd50d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 12 Jul 2015 22:58:35 -0700 Subject: [PATCH 08/32] Update frontend to latest version --- homeassistant/components/frontend/version.py | 2 +- .../frontend/www_static/frontend.html | 44 +++++++++---------- .../www_static/home-assistant-polymer | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index e8c139330ce..b0b2af4a48a 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 = "8716796b65ea358f91338b572d33f07f" +VERSION = "85ce191d6484327ae20265d457c6c4e7" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index 22d52ebe532..7436a5909fb 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -2321,7 +2321,7 @@ http://nicolasgallagher.com/micro-clearfix-hack/ border-bottom: none; cursor: help; } \ No newline at end of file + } \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer index b97996be23d..df15796f189 160000 --- a/homeassistant/components/frontend/www_static/home-assistant-polymer +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -1 +1 @@ -Subproject commit b97996be23de374f0e47b42c0518c05f6250cf41 +Subproject commit df15796f189f8f4c495a6d86a083b396597a421e From 7dba1b5303f69a6857c00f86e029174b0e389a2d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 17 Jul 2015 23:42:10 -0700 Subject: [PATCH 13/32] Remove comment from build_frontend --- scripts/build_frontend | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/build_frontend b/scripts/build_frontend index 3b8349a295a..9554e82256d 100755 --- a/scripts/build_frontend +++ b/scripts/build_frontend @@ -1,5 +1,4 @@ # Builds the frontend for production -# Call 'build_frontend demo' to build a demo frontend. # If current pwd is scripts, go 1 up. if [ ${PWD##*/} == "scripts" ]; then From a3906242e912b7116e836523b1edd3d5096085fc Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 19 Jul 2015 18:32:35 -0700 Subject: [PATCH 14/32] Make life of Windows users a bit better --- homeassistant/__main__.py | 9 ++++++--- homeassistant/components/frontend/version.py | 2 +- .../components/frontend/www_static/frontend.html | 16 ++++++++-------- .../frontend/www_static/home-assistant-polymer | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 6f937d6916e..658e64ad145 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -5,6 +5,7 @@ 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 @@ -123,6 +124,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() @@ -133,11 +137,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/frontend/version.py b/homeassistant/components/frontend/version.py index c91c3ef9726..4a67ed0fc0e 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 = "fcdb0ebfe95f973b1354ede21966454f" +VERSION = "4f94fd4404583fbf27cc899c024d26ff" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index b101972ce68..023347483cb 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -4857,11 +4857,11 @@ paper-ripple { font-weight: 300; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; - } \ No newline at end of file + } \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer index df15796f189..576c04efb49 160000 --- a/homeassistant/components/frontend/www_static/home-assistant-polymer +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -1 +1 @@ -Subproject commit df15796f189f8f4c495a6d86a083b396597a421e +Subproject commit 576c04efb49a8a5f7f35734458ffc93f874dd68d From e277decd4c1c7589f079fb10db8d0851cbaed461 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 19 Jul 2015 19:00:48 -0700 Subject: [PATCH 15/32] Add a check to ensure pip is installed --- homeassistant/__main__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 658e64ad145..2514b35587f 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -21,6 +21,16 @@ 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. @@ -36,6 +46,8 @@ def install_package(package): def validate_dependencies(): """ Validate all dependencies that HA uses. """ + ensure_pip() + print("Validating dependencies...") import_fail = False From 4edf53899d7fce057e8c85f2105cacfc34844098 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 19 Jul 2015 23:21:01 -0700 Subject: [PATCH 16/32] Port PyMySensors from external to requirements.txt --- .gitmodules | 3 --- homeassistant/components/sensor/mysensors.py | 28 +++++++++++--------- homeassistant/external/pymysensors | 1 - requirements.txt | 4 +-- 4 files changed, 17 insertions(+), 19 deletions(-) delete mode 160000 homeassistant/external/pymysensors diff --git a/.gitmodules b/.gitmodules index 174bba680f0..4ecccece153 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,9 +16,6 @@ [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/components/sensor/mysensors.py b/homeassistant/components/sensor/mysensors.py index 4f3c2610c5a..ad9649f9966 100644 --- a/homeassistant/components/sensor/mysensors.py +++ b/homeassistant/components/sensor/mysensors.py @@ -21,9 +21,6 @@ Port of your connection to your MySensors device. """ import logging -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.pymysensors.mysensors.mysensors as mysensors -import homeassistant.external.pymysensors.mysensors.const as const from homeassistant.helpers.entity import Entity from homeassistant.const import ( @@ -39,12 +36,16 @@ ATTR_NODE_ID = "node_id" ATTR_CHILD_ID = "child_id" _LOGGER = logging.getLogger(__name__) -REQUIREMENTS = ['pyserial>=2.7'] +REQUIREMENTS = ['https://github.com/theolind/pymysensors/archive/master.zip' + '#egg=pymysensors-0.1'] def setup_platform(hass, config, add_devices, discovery_info=None): """ Setup the mysensors platform. """ + import mysensors.mysensors as mysensors + import mysensors.const as const + devices = {} # keep track of devices added to HA # Just assume celcius means that the user wants metric for now. # It may make more sense to make this a global config option in the future. @@ -69,7 +70,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): name = '{} {}.{}'.format(sensor.sketch_name, nid, child.id) node[child_id][value_type] = \ MySensorsNodeValue( - nid, child_id, name, value_type, is_metric) + nid, child_id, name, value_type, is_metric, const) new_devices.append(node[child_id][value_type]) else: node[child_id][value_type].update_sensor( @@ -102,8 +103,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None): class MySensorsNodeValue(Entity): """ Represents the value of a MySensors child node. """ - # pylint: disable=too-many-arguments - def __init__(self, node_id, child_id, name, value_type, metric): + # pylint: disable=too-many-arguments, too-many-instance-attributes + def __init__(self, node_id, child_id, name, value_type, metric, const): self._name = name self.node_id = node_id self.child_id = child_id @@ -111,6 +112,7 @@ class MySensorsNodeValue(Entity): self.value_type = value_type self.metric = metric self._value = '' + self.const = const @property def should_poll(self): @@ -130,11 +132,11 @@ class MySensorsNodeValue(Entity): @property def unit_of_measurement(self): """ Unit of measurement of this entity. """ - if self.value_type == const.SetReq.V_TEMP: + if self.value_type == self.const.SetReq.V_TEMP: return TEMP_CELCIUS if self.metric else TEMP_FAHRENHEIT - elif self.value_type == const.SetReq.V_HUM or \ - self.value_type == const.SetReq.V_DIMMER or \ - self.value_type == const.SetReq.V_LIGHT_LEVEL: + elif self.value_type == self.const.SetReq.V_HUM or \ + self.value_type == self.const.SetReq.V_DIMMER or \ + self.value_type == self.const.SetReq.V_LIGHT_LEVEL: return '%' return None @@ -150,8 +152,8 @@ class MySensorsNodeValue(Entity): def update_sensor(self, value, battery_level): """ Update a sensor with the latest value from the controller. """ _LOGGER.info("%s value = %s", self._name, value) - if self.value_type == const.SetReq.V_TRIPPED or \ - self.value_type == const.SetReq.V_ARMED: + if self.value_type == self.const.SetReq.V_TRIPPED or \ + self.value_type == self.const.SetReq.V_ARMED: self._value = STATE_ON if int(value) == 1 else STATE_OFF else: self._value = value diff --git a/homeassistant/external/pymysensors b/homeassistant/external/pymysensors deleted file mode 160000 index cd5ef892eee..00000000000 --- a/homeassistant/external/pymysensors +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cd5ef892eeec0ad027727f7e8f757e7f2927da97 diff --git a/requirements.txt b/requirements.txt index c7a569fad33..f9d11975e97 100644 --- a/requirements.txt +++ b/requirements.txt @@ -77,5 +77,5 @@ python-forecastio>=1.3.3 # Firmata Bindings (*.arduino) PyMata==2.07a -# Mysensors serial gateway -pyserial>=2.7 +# Mysensors +https://github.com/theolind/pymysensors/archive/master.zip#egg=pymysensors-0.1 From 43cc3624eeab5a53c48decb127cbe829e75e6722 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 19 Jul 2015 23:44:32 -0700 Subject: [PATCH 17/32] Port PyNetgear from external to requirements.txt --- .gitmodules | 3 --- .../components/device_tracker/netgear.py | 17 +++-------------- homeassistant/external/pynetgear | 1 - requirements.txt | 3 +++ 4 files changed, 6 insertions(+), 18 deletions(-) delete mode 160000 homeassistant/external/pynetgear diff --git a/.gitmodules b/.gitmodules index 4ecccece153..b4ab8e17c0a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[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 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/external/pynetgear b/homeassistant/external/pynetgear deleted file mode 160000 index e946ecf7926..00000000000 --- a/homeassistant/external/pynetgear +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e946ecf7926b9b2adaa1e3127a9738201a1b1fc7 diff --git a/requirements.txt b/requirements.txt index f9d11975e97..f70d755d5d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -79,3 +79,6 @@ PyMata==2.07a # Mysensors https://github.com/theolind/pymysensors/archive/master.zip#egg=pymysensors-0.1 + +# Netgear (device_tracker.netgear) +pynetgear>=0.1 From 3efb1e4ac9a647922e6eacea9eac32823480aadc Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 20 Jul 2015 00:07:01 -0700 Subject: [PATCH 18/32] Port netdisco from external to requirements.txt --- .gitmodules | 3 --- homeassistant/components/discovery.py | 26 ++++++++----------- homeassistant/components/light/__init__.py | 2 +- .../components/media_player/__init__.py | 2 +- homeassistant/components/switch/__init__.py | 2 +- homeassistant/external/netdisco | 1 - requirements.txt | 6 ++--- 7 files changed, 17 insertions(+), 25 deletions(-) delete mode 160000 homeassistant/external/netdisco diff --git a/.gitmodules b/.gitmodules index b4ab8e17c0a..f33d9430f54 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 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/light/__init__.py b/homeassistant/components/light/__init__.py index 58c3c3cd8f2..35e80cc143d 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -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 = { diff --git a/homeassistant/components/media_player/__init__.py b/homeassistant/components/media_player/__init__.py index 0cb4608ba1b..8cd3353bea8 100644 --- a/homeassistant/components/media_player/__init__.py +++ b/homeassistant/components/media_player/__init__.py @@ -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' diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index 95457b66f5f..b141c36f7b5 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -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', } diff --git a/homeassistant/external/netdisco b/homeassistant/external/netdisco deleted file mode 160000 index b2cad7c2b95..00000000000 --- a/homeassistant/external/netdisco +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b2cad7c2b959efa8eee9b5ac62d87232bf0b5176 diff --git a/requirements.txt b/requirements.txt index f70d755d5d3..e601614bb96 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 From 2f622053a67cb868b1ea5217c86c469bd73b3d74 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 20 Jul 2015 00:08:00 -0700 Subject: [PATCH 19/32] Port PyWemo from external to requirements.txt --- .gitmodules | 3 --- homeassistant/components/switch/wemo.py | 13 ++----------- homeassistant/external/pywemo | 1 - requirements.txt | 3 +++ 4 files changed, 5 insertions(+), 15 deletions(-) delete mode 160000 homeassistant/external/pywemo diff --git a/.gitmodules b/.gitmodules index f33d9430f54..a627e522d8f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "homeassistant/external/pywemo"] - path = homeassistant/external/pywemo - url = https://github.com/balloob/pywemo.git [submodule "homeassistant/external/noop"] path = homeassistant/external/noop url = https://github.com/balloob/noop.git diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py index eb55e0662b7..33f5f03799b 100644 --- a/homeassistant/components/switch/wemo.py +++ b/homeassistant/components/switch/wemo.py @@ -12,17 +12,8 @@ from homeassistant.components.switch import SwitchDevice # pylint: disable=unused-argument def setup_platform(hass, config, add_devices_callback, discovery_info=None): """ Find and return WeMo switches. """ - try: - # pylint: disable=no-name-in-module, import-error - import homeassistant.external.pywemo.pywemo as pywemo - import homeassistant.external.pywemo.pywemo.discovery as discovery - except ImportError: - logging.getLogger(__name__).exception(( - "Failed to import pywemo. " - "Did you maybe not run `git submodule init` " - "and `git submodule update`?")) - - return + import pywemo + import pywemo.discovery as discovery if discovery_info is not None: device = discovery.device_from_description(discovery_info) diff --git a/homeassistant/external/pywemo b/homeassistant/external/pywemo deleted file mode 160000 index ca94e41faa4..00000000000 --- a/homeassistant/external/pywemo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ca94e41faa48c783f600a2efd550c6b7dae01b0d diff --git a/requirements.txt b/requirements.txt index e601614bb96..e910ffba95f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -82,3 +82,6 @@ pynetgear>=0.1 # Netdisco (discovery) netdisco>=0.1 + +# Wemo (switch.wemo) +pywemo>=0.1 From 40b2acb472e2ef623e66c16c7e8c0b38050f23a1 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 20 Jul 2015 00:41:57 -0700 Subject: [PATCH 20/32] Port wink from external to requirements.txt --- homeassistant/components/light/wink.py | 7 +- homeassistant/components/sensor/wink.py | 5 +- homeassistant/components/switch/wink.py | 5 +- homeassistant/components/wink.py | 6 +- homeassistant/external/wink/pywink.py | 408 ------------------------ requirements.txt | 3 + 6 files changed, 13 insertions(+), 421 deletions(-) delete mode 100644 homeassistant/external/wink/pywink.py diff --git a/homeassistant/components/light/wink.py b/homeassistant/components/light/wink.py index dc7b7041611..c4a47ca7da1 100644 --- a/homeassistant/components/light/wink.py +++ b/homeassistant/components/light/wink.py @@ -1,9 +1,6 @@ -""" Support for Hue lights. """ +""" Support for Wink lights. """ import logging -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.wink.pywink as pywink - from homeassistant.components.light import ATTR_BRIGHTNESS from homeassistant.components.wink import WinkToggleDevice from homeassistant.const import CONF_ACCESS_TOKEN @@ -11,6 +8,8 @@ from homeassistant.const import CONF_ACCESS_TOKEN def setup_platform(hass, config, add_devices_callback, discovery_info=None): """ Find and return Wink lights. """ + import pywink + token = config.get(CONF_ACCESS_TOKEN) if not pywink.is_token_set() and token is None: diff --git a/homeassistant/components/sensor/wink.py b/homeassistant/components/sensor/wink.py index ff61f02d041..1d52550aa37 100644 --- a/homeassistant/components/sensor/wink.py +++ b/homeassistant/components/sensor/wink.py @@ -1,15 +1,14 @@ """ Support for Wink sensors. """ import logging -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.wink.pywink as pywink - from homeassistant.helpers.entity import Entity from homeassistant.const import CONF_ACCESS_TOKEN, STATE_OPEN, STATE_CLOSED def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the Wink platform. """ + import pywink + if discovery_info is None: token = config.get(CONF_ACCESS_TOKEN) diff --git a/homeassistant/components/switch/wink.py b/homeassistant/components/switch/wink.py index add56d222b1..792de50a855 100644 --- a/homeassistant/components/switch/wink.py +++ b/homeassistant/components/switch/wink.py @@ -6,15 +6,14 @@ Support for Wink switches. """ import logging -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.wink.pywink as pywink - from homeassistant.components.wink import WinkToggleDevice from homeassistant.const import CONF_ACCESS_TOKEN def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the Wink platform. """ + import pywink + if discovery_info is None: token = config.get(CONF_ACCESS_TOKEN) diff --git a/homeassistant/components/wink.py b/homeassistant/components/wink.py index dd210bc2b7f..d56a244b84c 100644 --- a/homeassistant/components/wink.py +++ b/homeassistant/components/wink.py @@ -6,9 +6,6 @@ Connects to a Wink hub and loads relevant components to control its devices. """ import logging -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.wink.pywink as pywink - from homeassistant import bootstrap from homeassistant.loader import get_component from homeassistant.helpers import validate_config @@ -19,6 +16,8 @@ from homeassistant.const import ( DOMAIN = "wink" DEPENDENCIES = [] +REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/master.zip' + '#pywink>=0.1'] DISCOVER_LIGHTS = "wink.lights" DISCOVER_SWITCHES = "wink.switches" @@ -32,6 +31,7 @@ def setup(hass, config): if not validate_config(config, {DOMAIN: [CONF_ACCESS_TOKEN]}, logger): return False + import pywink pywink.set_bearer_token(config[DOMAIN][CONF_ACCESS_TOKEN]) # Load components for the devices in the Wink that we support diff --git a/homeassistant/external/wink/pywink.py b/homeassistant/external/wink/pywink.py deleted file mode 100644 index cbe50701707..00000000000 --- a/homeassistant/external/wink/pywink.py +++ /dev/null @@ -1,408 +0,0 @@ -__author__ = 'JOHNMCL' - -import json -import time - -import requests - -baseUrl = "https://winkapi.quirky.com" - -headers = {} - - -class wink_sensor_pod(object): - """ represents a wink.py sensor - json_obj holds the json stat at init (and if there is a refresh it's updated - it's the native format for this objects methods - and looks like so: -{ - "data": { - "last_event": { - "brightness_occurred_at": None, - "loudness_occurred_at": None, - "vibration_occurred_at": None - }, - "model_name": "Tripper", - "capabilities": { - "sensor_types": [ - { - "field": "opened", - "type": "boolean" - }, - { - "field": "battery", - "type": "percentage" - } - ] - }, - "manufacturer_device_model": "quirky_ge_tripper", - "location": "", - "radio_type": "zigbee", - "manufacturer_device_id": None, - "gang_id": None, - "sensor_pod_id": "37614", - "subscription": { - }, - "units": { - }, - "upc_id": "184", - "hidden_at": None, - "last_reading": { - "battery_voltage_threshold_2": 0, - "opened": False, - "battery_alarm_mask": 0, - "opened_updated_at": 1421697092.7347496, - "battery_voltage_min_threshold_updated_at": 1421697092.7347229, - "battery_voltage_min_threshold": 0, - "connection": None, - "battery_voltage": 25, - "battery_voltage_threshold_1": 25, - "connection_updated_at": None, - "battery_voltage_threshold_3": 0, - "battery_voltage_updated_at": 1421697092.7347066, - "battery_voltage_threshold_1_updated_at": 1421697092.7347302, - "battery_voltage_threshold_3_updated_at": 1421697092.7347434, - "battery_voltage_threshold_2_updated_at": 1421697092.7347374, - "battery": 1.0, - "battery_updated_at": 1421697092.7347553, - "battery_alarm_mask_updated_at": 1421697092.734716 - }, - "triggers": [ - ], - "name": "MasterBathroom", - "lat_lng": [ - 37.550773, - -122.279182 - ], - "uuid": "a2cb868a-dda3-4211-ab73-fc08087aeed7", - "locale": "en_us", - "device_manufacturer": "quirky_ge", - "created_at": 1421523277, - "local_id": "2", - "hub_id": "88264" - }, -} - - """ - def __init__(self, aJSonObj, objectprefix="sensor_pods"): - self.jsonState = aJSonObj - self.objectprefix = objectprefix - - def __str__(self): - return "%s %s %s" % (self.name(), self.deviceId(), self.state()) - - def __repr__(self): - return "" % (self.name(), self.deviceId(), self.state()) - - @property - def _last_reading(self): - return self.jsonState.get('last_reading') or {} - - def name(self): - return self.jsonState.get('name', "Unknown Name") - - def state(self): - return self._last_reading.get('opened', False) - - def deviceId(self): - return self.jsonState.get('sensor_pod_id', self.name()) - - def refresh_state_at_hub(self): - """ - Tell hub to query latest status from device and upload to Wink. - PS: Not sure if this even works.. - """ - urlString = baseUrl + "/%s/%s/refresh" % (self.objectprefix, self.deviceId()) - requests.get(urlString, headers=headers) - - def updateState(self): - """ Update state with latest info from Wink API. """ - urlString = baseUrl + "/%s/%s" % (self.objectprefix, self.deviceId()) - arequest = requests.get(urlString, headers=headers) - self._updateStateFromResponse(arequest.json()) - - def _updateStateFromResponse(self, response_json): - """ - :param response_json: the json obj returned from query - :return: - """ - self.jsonState = response_json.get('data') - -class wink_binary_switch(object): - """ represents a wink.py switch - json_obj holds the json stat at init (and if there is a refresh it's updated - it's the native format for this objects methods - and looks like so: - -{ - "data": { - "binary_switch_id": "4153", - "name": "Garage door indicator", - "locale": "en_us", - "units": {}, - "created_at": 1411614982, - "hidden_at": null, - "capabilities": {}, - "subscription": {}, - "triggers": [], - "desired_state": { - "powered": false - }, - "manufacturer_device_model": "leviton_dzs15", - "manufacturer_device_id": null, - "device_manufacturer": "leviton", - "model_name": "Switch", - "upc_id": "94", - "gang_id": null, - "hub_id": "11780", - "local_id": "9", - "radio_type": "zwave", - "last_reading": { - "powered": false, - "powered_updated_at": 1411614983.6153464, - "powering_mode": null, - "powering_mode_updated_at": null, - "consumption": null, - "consumption_updated_at": null, - "cost": null, - "cost_updated_at": null, - "budget_percentage": null, - "budget_percentage_updated_at": null, - "budget_velocity": null, - "budget_velocity_updated_at": null, - "summation_delivered": null, - "summation_delivered_updated_at": null, - "sum_delivered_multiplier": null, - "sum_delivered_multiplier_updated_at": null, - "sum_delivered_divisor": null, - "sum_delivered_divisor_updated_at": null, - "sum_delivered_formatting": null, - "sum_delivered_formatting_updated_at": null, - "sum_unit_of_measure": null, - "sum_unit_of_measure_updated_at": null, - "desired_powered": false, - "desired_powered_updated_at": 1417893563.7567682, - "desired_powering_mode": null, - "desired_powering_mode_updated_at": null - }, - "current_budget": null, - "lat_lng": [ - 38.429996, - -122.653721 - ], - "location": "", - "order": 0 - }, - "errors": [], - "pagination": {} -} - - """ - def __init__(self, aJSonObj, objectprefix="binary_switches"): - self.jsonState = aJSonObj - self.objectprefix = objectprefix - # Tuple (desired state, time) - self._last_call = (0, None) - - def __str__(self): - return "%s %s %s" % (self.name(), self.deviceId(), self.state()) - - def __repr__(self): - return "" % (self.name(), self.deviceId(), self.state()) - - @property - def _last_reading(self): - return self.jsonState.get('last_reading') or {} - - def name(self): - return self.jsonState.get('name', "Unknown Name") - - def state(self): - # Optimistic approach to setState: - # Within 15 seconds of a call to setState we assume it worked. - if self._recent_state_set(): - return self._last_call[1] - - return self._last_reading.get('powered', False) - - def deviceId(self): - return self.jsonState.get('binary_switch_id', self.name()) - - def setState(self, state): - """ - :param state: a boolean of true (on) or false ('off') - :return: nothing - """ - urlString = baseUrl + "/%s/%s" % (self.objectprefix, self.deviceId()) - values = {"desired_state": {"powered": state}} - arequest = requests.put(urlString, data=json.dumps(values), headers=headers) - self._updateStateFromResponse(arequest.json()) - - self._last_call = (time.time(), state) - - def refresh_state_at_hub(self): - """ - Tell hub to query latest status from device and upload to Wink. - PS: Not sure if this even works.. - """ - urlString = baseUrl + "/%s/%s/refresh" % (self.objectprefix, self.deviceId()) - requests.get(urlString, headers=headers) - - def updateState(self): - """ Update state with latest info from Wink API. """ - urlString = baseUrl + "/%s/%s" % (self.objectprefix, self.deviceId()) - arequest = requests.get(urlString, headers=headers) - self._updateStateFromResponse(arequest.json()) - - def wait_till_desired_reached(self): - """ Wait till desired state reached. Max 10s. """ - if self._recent_state_set(): - return - - # self.refresh_state_at_hub() - tries = 1 - - while True: - self.updateState() - last_read = self._last_reading - - if last_read.get('desired_powered') == last_read.get('powered') \ - or tries == 5: - break - - time.sleep(2) - - tries += 1 - self.updateState() - last_read = self._last_reading - - def _updateStateFromResponse(self, response_json): - """ - :param response_json: the json obj returned from query - :return: - """ - self.jsonState = response_json.get('data') - - def _recent_state_set(self): - return time.time() - self._last_call[0] < 15 - - -class wink_bulb(wink_binary_switch): - """ represents a wink.py bulb - json_obj holds the json stat at init (and if there is a refresh it's updated - it's the native format for this objects methods - and looks like so: - - "light_bulb_id": "33990", - "name": "downstaurs lamp", - "locale": "en_us", - "units":{}, - "created_at": 1410925804, - "hidden_at": null, - "capabilities":{}, - "subscription":{}, - "triggers":[], - "desired_state":{"powered": true, "brightness": 1}, - "manufacturer_device_model": "lutron_p_pkg1_w_wh_d", - "manufacturer_device_id": null, - "device_manufacturer": "lutron", - "model_name": "Caseta Wireless Dimmer & Pico", - "upc_id": "3", - "hub_id": "11780", - "local_id": "8", - "radio_type": "lutron", - "linked_service_id": null, - "last_reading":{ - "brightness": 1, - "brightness_updated_at": 1417823487.490747, - "connection": true, - "connection_updated_at": 1417823487.4907365, - "powered": true, - "powered_updated_at": 1417823487.4907532, - "desired_powered": true, - "desired_powered_updated_at": 1417823485.054675, - "desired_brightness": 1, - "desired_brightness_updated_at": 1417409293.2591703 - }, - "lat_lng":[38.429962, -122.653715], - "location": "", - "order": 0 - - """ - jsonState = {} - - def __init__(self, ajsonobj): - super().__init__(ajsonobj, "light_bulbs") - - def deviceId(self): - return self.jsonState.get('light_bulb_id', self.name()) - - def brightness(self): - return self._last_reading.get('brightness') - - def setState(self, state, brightness=None): - """ - :param state: a boolean of true (on) or false ('off') - :return: nothing - """ - urlString = baseUrl + "/light_bulbs/%s" % self.deviceId() - values = { - "desired_state": { - "powered": state - } - } - - if brightness is not None: - values["desired_state"]["brightness"] = brightness - - urlString = baseUrl + "/light_bulbs/%s" % self.deviceId() - arequest = requests.put(urlString, data=json.dumps(values), headers=headers) - self._updateStateFromResponse(arequest.json()) - - self._last_call = (time.time(), state) - - def __repr__(self): - return "" % ( - self.name(), self.deviceId(), self.state()) - - -def get_devices(filter, constructor): - arequestUrl = baseUrl + "/users/me/wink_devices" - j = requests.get(arequestUrl, headers=headers).json() - - items = j.get('data') - - devices = [] - for item in items: - id = item.get(filter) - if (id is not None and item.get("hidden_at") is None): - devices.append(constructor(item)) - - return devices - -def get_bulbs(): - return get_devices('light_bulb_id', wink_bulb) - -def get_switches(): - return get_devices('binary_switch_id', wink_binary_switch) - -def get_sensors(): - return get_devices('sensor_pod_id', wink_sensor_pod) - -def is_token_set(): - """ Returns if an auth token has been set. """ - return bool(headers) - - -def set_bearer_token(token): - global headers - - headers = { - "Content-Type": "application/json", - "Authorization": "Bearer {}".format(token) - } - -if __name__ == "__main__": - sw = get_bulbs() - lamp = sw[3] - lamp.setState(False) diff --git a/requirements.txt b/requirements.txt index e910ffba95f..e9365a63811 100644 --- a/requirements.txt +++ b/requirements.txt @@ -85,3 +85,6 @@ netdisco>=0.1 # Wemo (switch.wemo) pywemo>=0.1 + +# Wink (*.wink) +https://github.com/balloob/python-wink/archive/master.zip#pywink>=0.1 From cbb390a918f62f2bdef6a8cceda327f0024bb45e Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Thu, 23 Jul 2015 18:13:46 +0200 Subject: [PATCH 21/32] Custom min/max temperature for thermostat --- .../components/thermostat/__init__.py | 20 ++++++++++++++++++- .../components/thermostat/heat_control.py | 20 ++++++++++--------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/thermostat/__init__.py b/homeassistant/components/thermostat/__init__.py index 08940b977c9..dffa7dfcc26 100644 --- a/homeassistant/components/thermostat/__init__.py +++ b/homeassistant/components/thermostat/__init__.py @@ -11,7 +11,7 @@ from homeassistant.helpers.entity_component import EntityComponent import homeassistant.util as util from homeassistant.helpers.entity import Entity from homeassistant.const import ( - ATTR_ENTITY_ID, ATTR_TEMPERATURE, STATE_ON, STATE_OFF) + ATTR_ENTITY_ID, ATTR_TEMPERATURE, STATE_ON, STATE_OFF, TEMP_CELCIUS) DOMAIN = "thermostat" DEPENDENCIES = [] @@ -24,6 +24,8 @@ SERVICE_SET_TEMPERATURE = "set_temperature" ATTR_CURRENT_TEMPERATURE = "current_temperature" ATTR_AWAY_MODE = "away_mode" +ATTR_MAX_TEMP = "max_temp" +ATTR_MIN_TEMP = "min_temp" _LOGGER = logging.getLogger(__name__) @@ -131,6 +133,22 @@ class ThermostatDevice(Entity): if device_attr is not None: data.update(device_attr) + if hasattr(self, ATTR_MIN_TEMP): + min_temp = self.hass.config.temperature( + getattr(self, ATTR_MIN_TEMP), self.unit_of_measurement)[0] + else: + min_temp = self.hass.config.temperature( + 7, TEMP_CELCIUS)[0] + data[ATTR_MIN_TEMP] = min_temp + + if hasattr(self, ATTR_MAX_TEMP): + max_temp = self.hass.config.temperature( + getattr(self, ATTR_MAX_TEMP), self.unit_of_measurement)[0] + else: + max_temp = self.hass.config.temperature( + 35, TEMP_CELCIUS)[0] + data[ATTR_MAX_TEMP] = max_temp + return data @property diff --git a/homeassistant/components/thermostat/heat_control.py b/homeassistant/components/thermostat/heat_control.py index d21245dae3a..273f1173da8 100644 --- a/homeassistant/components/thermostat/heat_control.py +++ b/homeassistant/components/thermostat/heat_control.py @@ -90,16 +90,18 @@ class HeatControl(ThermostatDevice): self.target_sensor_entity_id = config.get("target_sensor") self.time_temp = [] - for time_temp in list(config.get("time_temp").split(",")): - time, temp = time_temp.split(':') - time_start, time_end = time.split('-') - start_time = datetime.datetime.time(datetime.datetime. - strptime(time_start, '%H%M')) - end_time = datetime.datetime.time(datetime.datetime. - strptime(time_end, '%H%M')) - self.time_temp.append((start_time, end_time, float(temp))) + if config.get("time_temp"): + for time_temp in list(config.get("time_temp").split(",")): + time, temp = time_temp.split(':') + time_start, time_end = time.split('-') + start_time = datetime.datetime.time( + datetime.datetime.strptime(time_start, '%H%M')) + end_time = datetime.datetime.time( + datetime.datetime.strptime(time_end, '%H%M')) + self.time_temp.append((start_time, end_time, float(temp))) self.min_temp = float(config.get("min_temp")) + self.max_temp = float(config.get("max_temp")) self._manual_sat_temp = None self._away = False @@ -178,7 +180,7 @@ class HeatControl(ThermostatDevice): if not self._heater_manual_changed: pass else: - self.set_temperature(100) + self.set_temperature(self.max_temp) self._heater_manual_changed = True From 44ce756cbae80b5f672a3ded64aae7e9eb4c91c8 Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Thu, 23 Jul 2015 19:36:05 +0200 Subject: [PATCH 22/32] Support for rfxtrx sensors --- homeassistant/components/sensor/rfxtrx.py | 119 ++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 homeassistant/components/sensor/rfxtrx.py diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py new file mode 100644 index 00000000000..879e3326eb8 --- /dev/null +++ b/homeassistant/components/sensor/rfxtrx.py @@ -0,0 +1,119 @@ +""" +homeassistant.components.sensor.rfxtrx +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Shows sensor values from rfxtrx sensors. + +Possible config keys: + +path to rfxtrx device +device=/dev/serial/by-id/usb-rfxtrx_RFXtrx433_A1Y0NJGR-if00-port0 + +id of the sensor: Name the sensor with ID +135=Outside + +only_named: Only show the named sensors +only_named=1 + +datatype_mask: mask to determine which sensor values to show based on + +datatype_mask=1 # only show temperature +datatype_mask=127 # show all sensor values +""" +import logging +from collections import OrderedDict + +from homeassistant.const import ( + ATTR_BATTERY_LEVEL, TEMP_CELCIUS) +from homeassistant.helpers.entity import Entity + +REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/archive/master.zip' + '#RFXtrx>=0.15'] + +DATA_TYPES = OrderedDict([ + ('Temperature', TEMP_CELCIUS), + ('Humidity', '%'), + ('Forecast', ''), + ('Barometer', ''), + ('Wind direction', ''), + ('Humidity status', ''), + ('Humidity status numeric', ''), + ('Forecast numeric', ''), + ('Rain rate', ''), + ('Rain total', ''), + ('Wind average speed', ''), + ('Wind gust', ''), + ('Chill', ''), + ('Battery numeric', ATTR_BATTERY_LEVEL), + ('Rssi numeric', '')]) + + +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Setup the rfxtrx platform. """ + logger = logging.getLogger(__name__) + + devices = {} # keep track of devices added to HA + + def sensor_update(event): + """ Callback for sensor updates from the MySensors gateway. """ + if event.device.id_string in devices: + devices[event.device.id_string].event = event + else: + logger.info("adding new devices: %s", event.device.type_string) + new_device = RfxtrxSensor(event) + devices[event.device.id_string] = new_device + add_devices([new_device]) + try: + import RFXtrx as rfxtrx + except ImportError: + logger.exception( + "Failed to import rfxtrx") + return False + + device = config.get("device", True) + rfxtrx.Core(device, sensor_update) + + +class RfxtrxSensor(Entity): + """ Represents a Vera Sensor. """ + + def __init__(self, event): + self.event = event + + self._unit_of_measurement = None + self._data_type = None + for data_type in DATA_TYPES: + if data_type in self.event.values: + self._unit_of_measurement = DATA_TYPES[data_type] + self._data_type = data_type + break + + id_string = int(event.device.id_string.replace(":", ""), 16) + self._name = "{} {} ({})".format(self._data_type, + self.event.device.type_string, + id_string) + + def __str__(self): + return self._name + + @property + def state(self): + if self._data_type: + return self.event.values[self._data_type] + return None + + @property + def name(self): + """ Get the mame of the sensor. """ + return self._name + + @property + def state_attributes(self): + attr = super().state_attributes + for data_type in DATA_TYPES: + if data_type in self.event.values: + attr[data_type] = self.event.values[data_type] + return attr + + @property + def unit_of_measurement(self): + return self._unit_of_measurement From f44acc9b0e695e96507c21aefa84325c7d792a67 Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Thu, 23 Jul 2015 19:42:20 +0200 Subject: [PATCH 23/32] requirements file --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements.txt b/requirements.txt index c7a569fad33..06aea3fa518 100644 --- a/requirements.txt +++ b/requirements.txt @@ -79,3 +79,6 @@ PyMata==2.07a # Mysensors serial gateway pyserial>=2.7 + +#Rfxtrx sensor +https://github.com/Danielhiversen/pyRFXtrx/archive/master.zip From 8f99ebf27e676390c2ee919c8b8c5b8d20462934 Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Thu, 23 Jul 2015 19:47:45 +0200 Subject: [PATCH 24/32] Documentation of rfxtrx sensor --- homeassistant/components/sensor/rfxtrx.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index 879e3326eb8..c2950c0d9c2 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -4,20 +4,14 @@ homeassistant.components.sensor.rfxtrx Shows sensor values from rfxtrx sensors. Possible config keys: +device="path to rfxtrx device" -path to rfxtrx device -device=/dev/serial/by-id/usb-rfxtrx_RFXtrx433_A1Y0NJGR-if00-port0 +Example: -id of the sensor: Name the sensor with ID -135=Outside +sensor 2: + platform: rfxtrx + device : /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0 -only_named: Only show the named sensors -only_named=1 - -datatype_mask: mask to determine which sensor values to show based on - -datatype_mask=1 # only show temperature -datatype_mask=127 # show all sensor values """ import logging from collections import OrderedDict From b54c58235f49f93fc3245a351a29ba636b79ea91 Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Thu, 23 Jul 2015 19:50:26 +0200 Subject: [PATCH 25/32] Documentation of rfxtrx sensor --- homeassistant/components/sensor/rfxtrx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index c2950c0d9c2..12e6afde3d1 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -8,7 +8,7 @@ device="path to rfxtrx device" Example: -sensor 2: +sensor 2: platform: rfxtrx device : /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0 From be937a795aaf2ea144c4cf8d8fb7004834f31333 Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Thu, 23 Jul 2015 22:15:17 +0200 Subject: [PATCH 26/32] Min max temp for thermostat --- .../components/thermostat/__init__.py | 27 +++++++++---------- .../components/thermostat/heat_control.py | 15 +++++++++-- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/homeassistant/components/thermostat/__init__.py b/homeassistant/components/thermostat/__init__.py index dffa7dfcc26..40e392709f2 100644 --- a/homeassistant/components/thermostat/__init__.py +++ b/homeassistant/components/thermostat/__init__.py @@ -133,21 +133,8 @@ class ThermostatDevice(Entity): if device_attr is not None: data.update(device_attr) - if hasattr(self, ATTR_MIN_TEMP): - min_temp = self.hass.config.temperature( - getattr(self, ATTR_MIN_TEMP), self.unit_of_measurement)[0] - else: - min_temp = self.hass.config.temperature( - 7, TEMP_CELCIUS)[0] - data[ATTR_MIN_TEMP] = min_temp - - if hasattr(self, ATTR_MAX_TEMP): - max_temp = self.hass.config.temperature( - getattr(self, ATTR_MAX_TEMP), self.unit_of_measurement)[0] - else: - max_temp = self.hass.config.temperature( - 35, TEMP_CELCIUS)[0] - data[ATTR_MAX_TEMP] = max_temp + data[ATTR_MIN_TEMP] = self.min_temp + data[ATTR_MAX_TEMP] = self.max_temp return data @@ -180,3 +167,13 @@ class ThermostatDevice(Entity): def turn_away_mode_off(self): """ Turns away mode off. """ pass + + @property + def min_temp(self): + """ Return minimum temperature. """ + return self.hass.config.temperature(7, TEMP_CELCIUS)[0] + + @property + def max_temp(self): + """ Return maxmum temperature. """ + return self.hass.config.temperature(35, TEMP_CELCIUS)[0] diff --git a/homeassistant/components/thermostat/heat_control.py b/homeassistant/components/thermostat/heat_control.py index 273f1173da8..54e7cc3e3a5 100644 --- a/homeassistant/components/thermostat/heat_control.py +++ b/homeassistant/components/thermostat/heat_control.py @@ -62,6 +62,7 @@ import logging import datetime import homeassistant.components as core +import homeassistant.util as util from homeassistant.components.thermostat import ThermostatDevice from homeassistant.const import TEMP_CELCIUS, STATE_ON, STATE_OFF @@ -100,8 +101,8 @@ class HeatControl(ThermostatDevice): datetime.datetime.strptime(time_end, '%H%M')) self.time_temp.append((start_time, end_time, float(temp))) - self.min_temp = float(config.get("min_temp")) - self.max_temp = float(config.get("max_temp")) + self._min_temp = util.convert(config.get("min_temp"), float, 0) + self._max_temp = util.convert(config.get("max_temp"), float, 100) self._manual_sat_temp = None self._away = False @@ -196,3 +197,13 @@ class HeatControl(ThermostatDevice): def turn_away_mode_off(self): """ Turns away mode off. """ self._away = False + + @property + def min_temp(self): + """ Return minimum temperature. """ + return self._min_temp + + @property + def max_temp(self): + """ Return maxmum temperature. """ + return self._max_temp From 22c72060cf99654d77eb358979d399ddd8355171 Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Thu, 23 Jul 2015 22:24:48 +0200 Subject: [PATCH 27/32] Make only_named: 0 work --- homeassistant/components/sensor/tellstick.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/tellstick.py b/homeassistant/components/sensor/tellstick.py index 5720b65a669..f80a3c19f12 100644 --- a/homeassistant/components/sensor/tellstick.py +++ b/homeassistant/components/sensor/tellstick.py @@ -77,7 +77,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): try: sensor_name = config[ts_sensor.id] except KeyError: - if 'only_named' in config: + if util.convert(config.get('only_named'), bool, False): continue sensor_name = str(ts_sensor.id) From 445aaeb700ae091dcb6792fd813f84d1f4f305c4 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 24 Jul 2015 03:28:21 -0700 Subject: [PATCH 28/32] New compiled version of frontend --- homeassistant/components/frontend/version.py | 2 +- .../frontend/www_static/frontend.html | 96 ++++++++++++++----- .../www_static/home-assistant-polymer | 2 +- 3 files changed, 73 insertions(+), 27 deletions(-) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 4a67ed0fc0e..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 = "4f94fd4404583fbf27cc899c024d26ff" +VERSION = "ccfe7497d635ab4df3e6943b05adbd9b" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index 023347483cb..c8cabd1b0a3 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -1,6 +1,6 @@ \ No newline at end of file + } \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer index 576c04efb49..5a3fcc970b3 160000 --- a/homeassistant/components/frontend/www_static/home-assistant-polymer +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -1 +1 @@ -Subproject commit 576c04efb49a8a5f7f35734458ffc93f874dd68d +Subproject commit 5a3fcc970b30d640e6a370b6f20904a745f69659 From 1489af0ecaa5b16ca5951482a50d5136ebad5faf Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Fri, 24 Jul 2015 12:35:03 +0200 Subject: [PATCH 29/32] updated rfxcom sensor --- homeassistant/components/sensor/rfxtrx.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index 12e6afde3d1..1b2a4643449 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -16,8 +16,7 @@ sensor 2: import logging from collections import OrderedDict -from homeassistant.const import ( - ATTR_BATTERY_LEVEL, TEMP_CELCIUS) +from homeassistant.const import (TEMP_CELCIUS) from homeassistant.helpers.entity import Entity REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/archive/master.zip' @@ -37,7 +36,7 @@ DATA_TYPES = OrderedDict([ ('Wind average speed', ''), ('Wind gust', ''), ('Chill', ''), - ('Battery numeric', ATTR_BATTERY_LEVEL), + ('Battery numeric', '%'), ('Rssi numeric', '')]) @@ -102,11 +101,7 @@ class RfxtrxSensor(Entity): @property def state_attributes(self): - attr = super().state_attributes - for data_type in DATA_TYPES: - if data_type in self.event.values: - attr[data_type] = self.event.values[data_type] - return attr + return self.event.values @property def unit_of_measurement(self): From 3658c579129151980765886464054cf23aa7d214 Mon Sep 17 00:00:00 2001 From: Daniel Hoyer Iversen Date: Fri, 24 Jul 2015 13:06:15 +0200 Subject: [PATCH 30/32] updated rfxcom sensor --- homeassistant/components/sensor/rfxtrx.py | 32 ++++++++--------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index 1b2a4643449..b9762995ea5 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -25,36 +25,26 @@ REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/archive/master.zip' DATA_TYPES = OrderedDict([ ('Temperature', TEMP_CELCIUS), ('Humidity', '%'), - ('Forecast', ''), ('Barometer', ''), ('Wind direction', ''), - ('Humidity status', ''), - ('Humidity status numeric', ''), - ('Forecast numeric', ''), - ('Rain rate', ''), - ('Rain total', ''), - ('Wind average speed', ''), - ('Wind gust', ''), - ('Chill', ''), - ('Battery numeric', '%'), - ('Rssi numeric', '')]) + ('Rain rate', '')]) def setup_platform(hass, config, add_devices, discovery_info=None): """ Setup the rfxtrx platform. """ logger = logging.getLogger(__name__) - devices = {} # keep track of devices added to HA + sensors = {} # keep track of sensors added to HA def sensor_update(event): - """ Callback for sensor updates from the MySensors gateway. """ - if event.device.id_string in devices: - devices[event.device.id_string].event = event + """ Callback for sensor updates from the RFXtrx gateway. """ + if event.device.id_string in sensors: + sensors[event.device.id_string].event = event else: - logger.info("adding new devices: %s", event.device.type_string) - new_device = RfxtrxSensor(event) - devices[event.device.id_string] = new_device - add_devices([new_device]) + logger.info("adding new sensor: %s", event.device.type_string) + new_sensor = RfxtrxSensor(event) + sensors[event.device.id_string] = new_sensor + add_devices([new_sensor]) try: import RFXtrx as rfxtrx except ImportError: @@ -62,12 +52,12 @@ def setup_platform(hass, config, add_devices, discovery_info=None): "Failed to import rfxtrx") return False - device = config.get("device", True) + device = config.get("device", "") rfxtrx.Core(device, sensor_update) class RfxtrxSensor(Entity): - """ Represents a Vera Sensor. """ + """ Represents a Rfxtrx Sensor. """ def __init__(self, event): self.event = event From 4845c1290c4306afdfd95108639a26ba1d09ac5f Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 23 Jun 2015 12:34:55 +0200 Subject: [PATCH 31/32] remove unused stuff and update the names (same as in owm sensor) --- homeassistant/components/sensor/forecast.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/sensor/forecast.py b/homeassistant/components/sensor/forecast.py index abd3cdadb73..613dd35d640 100644 --- a/homeassistant/components/sensor/forecast.py +++ b/homeassistant/components/sensor/forecast.py @@ -1,7 +1,6 @@ """ homeassistant.components.sensor.forecast ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Forecast.io service. Configuration: @@ -121,10 +120,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # pylint: disable=too-few-public-methods class ForeCastSensor(Entity): - """ Implements an OpenWeatherMap sensor. """ + """ Implements an Forecast.io sensor. """ def __init__(self, weather_data, sensor_type, unit): - self.client_name = 'Forecast' + self.client_name = 'Weather' self._name = SENSOR_TYPES[sensor_type][0] self.forecast_client = weather_data self._unit = unit @@ -135,7 +134,7 @@ class ForeCastSensor(Entity): @property def name(self): - return '{} - {}'.format(self.client_name, self._name) + return '{} {}'.format(self.client_name, self._name) @property def state(self): @@ -157,10 +156,6 @@ class ForeCastSensor(Entity): try: if self.type == 'summary': self._state = data.summary - # elif self.type == 'sunrise_time': - # self._state = data.sunriseTime - # elif self.type == 'sunset_time': - # self._state = data.sunsetTime elif self.type == 'precip_intensity': if data.precipIntensity == 0: self._state = 'None' From c1b428489fb5cf959ddeb10374ff2866bf263832 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Jul 2015 18:58:32 +0200 Subject: [PATCH 32/32] fix requirement --- homeassistant/components/sensor/openweathermap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/openweathermap.py b/homeassistant/components/sensor/openweathermap.py index 22720748034..f4635cd13ca 100644 --- a/homeassistant/components/sensor/openweathermap.py +++ b/homeassistant/components/sensor/openweathermap.py @@ -48,7 +48,7 @@ from homeassistant.util import Throttle from homeassistant.const import (CONF_API_KEY, TEMP_CELCIUS, TEMP_FAHRENHEIT) from homeassistant.helpers.entity import Entity -REQUIREMENTS = ['pywm>=2.2.1'] +REQUIREMENTS = ['pyowm>=2.2.1'] _LOGGER = logging.getLogger(__name__) SENSOR_TYPES = { 'weather': ['Condition', ''],