From 30ba447c64dd73ea6370e45988540e901d51d675 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 29 Oct 2014 00:47:55 -0700 Subject: [PATCH] More material love for interface --- config/custom_components/example.py | 4 +- homeassistant/components/device_tracker.py | 3 +- homeassistant/components/group.py | 6 +- homeassistant/components/http/frontend.py | 2 +- .../components/http/www_static/frontend.html | 3038 +++++++++++++---- .../http/www_static/polymer/bower.json | 5 +- .../http/www_static/polymer/domain-icon.html | 47 + .../polymer/home-assistant-api.html | 6 + .../polymer/home-assistant-main.html | 37 +- .../http/www_static/polymer/state-badge.html | 34 + .../http/www_static/polymer/state-card.html | 154 +- .../http/www_static/polymer/states-cards.html | 40 +- homeassistant/components/light/__init__.py | 3 +- homeassistant/components/wemo.py | 4 +- 14 files changed, 2567 insertions(+), 816 deletions(-) create mode 100644 homeassistant/components/http/www_static/polymer/domain-icon.html create mode 100644 homeassistant/components/http/www_static/polymer/state-badge.html diff --git a/config/custom_components/example.py b/config/custom_components/example.py index afee05bf5c8..f7ece4db5ea 100644 --- a/config/custom_components/example.py +++ b/config/custom_components/example.py @@ -9,9 +9,11 @@ Bare minimum what is needed for a component to be valid. DOMAIN = "example" # List of component names (string) your component depends upon -# If you are setting up a group but not using a group for anything, don't depend on group +# If you are setting up a group but not using a group for anything, +# don't depend on group DEPENDENCIES = [] + # pylint: disable=unused-argument def setup(hass, config): """ Register services or listen for events that your component needs. """ diff --git a/homeassistant/components/device_tracker.py b/homeassistant/components/device_tracker.py index 2a3ae9c3970..df2fbb99de6 100644 --- a/homeassistant/components/device_tracker.py +++ b/homeassistant/components/device_tracker.py @@ -143,7 +143,8 @@ class DeviceTracker(object): self.update_devices() - group.setup_group(hass, GROUP_NAME_ALL_DEVICES, self.device_entity_ids) + group.setup_group( + hass, GROUP_NAME_ALL_DEVICES, self.device_entity_ids, False) @property def device_entity_ids(self): diff --git a/homeassistant/components/group.py b/homeassistant/components/group.py index e3c7d3586ea..b311f9ee0e9 100644 --- a/homeassistant/components/group.py +++ b/homeassistant/components/group.py @@ -17,6 +17,8 @@ DEPENDENCIES = [] ENTITY_ID_FORMAT = DOMAIN + ".{}" +ATTR_AUTO = "auto" + _GROUP_TYPES = { "on_off": (STATE_ON, STATE_OFF), "home_not_home": (STATE_HOME, STATE_NOT_HOME) @@ -100,7 +102,7 @@ def setup(hass, config): # pylint: disable=too-many-branches -def setup_group(hass, name, entity_ids): +def setup_group(hass, name, entity_ids, user_defined=True): """ Sets up a group state that is the combined state of several states. Supports ON/OFF and DEVICE_HOME/DEVICE_NOT_HOME. """ @@ -161,7 +163,7 @@ def setup_group(hass, name, entity_ids): else: group_entity_id = ENTITY_ID_FORMAT.format(name) - state_attr = {ATTR_ENTITY_ID: entity_ids} + state_attr = {ATTR_ENTITY_ID: entity_ids, ATTR_AUTO: not user_defined} # pylint: disable=unused-argument def update_group_state(entity_id, old_state, new_state): diff --git a/homeassistant/components/http/frontend.py b/homeassistant/components/http/frontend.py index c7afd7e46cc..43045d35be5 100644 --- a/homeassistant/components/http/frontend.py +++ b/homeassistant/components/http/frontend.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_polymer script """ -VERSION = "460fa7f075841b858b102678f13fb070" +VERSION = "57f41262ccbd90c2e988e5be0a5dab59" diff --git a/homeassistant/components/http/www_static/frontend.html b/homeassistant/components/http/www_static/frontend.html index 06411ab9744..5d59404ce18 100644 --- a/homeassistant/components/http/www_static/frontend.html +++ b/homeassistant/components/http/www_static/frontend.html @@ -3268,6 +3268,970 @@ root if there is one. This implies: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - @@ -9256,6 +9561,12 @@ core-item { } }, + getCustomGroups: function() { + return this.states.filter(function(state) { + return state.entity_id.lastIndexOf("group.") == 0; + }) + }, + turn_on: function(entity_id) { this.call_service("homeassistant", "turn_on", {entity_id: entity_id}); }, @@ -12539,103 +12850,1293 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +