From 2016da984aec01ae05b11387c87390263c40cbc7 Mon Sep 17 00:00:00 2001
From: Paulus Schoutsen
Date: Mon, 19 Jan 2015 22:40:30 -0800
Subject: [PATCH] Tweaks to the configurator UI
---
homeassistant/components/configurator.py | 17 ++++++-----
homeassistant/components/http/frontend.py | 2 +-
.../components/http/www_static/frontend.html | 13 +++++----
.../cards/state-card-configurator.html | 28 +++++++++++++++++++
.../polymer/cards/state-card-content.html | 1 +
.../polymer/dialogs/more-info-dialog.html | 1 -
.../polymer/home-assistant-api.html | 2 +-
.../more-infos/more-info-configurator.html | 6 +++-
tests/test_component_configurator.py | 6 ++--
9 files changed, 57 insertions(+), 19 deletions(-)
create mode 100644 homeassistant/components/http/www_static/polymer/cards/state-card-configurator.html
diff --git a/homeassistant/components/configurator.py b/homeassistant/components/configurator.py
index 3ece10d4d4..2e43e9c54f 100644
--- a/homeassistant/components/configurator.py
+++ b/homeassistant/components/configurator.py
@@ -10,9 +10,9 @@ A callback has to be provided to `request_config` which will be called when
the user has submitted configuration information.
"""
import logging
-import threading
from homeassistant.helpers import generate_entity_id
+from homeassistant.const import EVENT_TIME_CHANGED
DOMAIN = "configurator"
DEPENDENCIES = []
@@ -155,14 +155,17 @@ class Configurator(object):
entity_id = self._requests.pop(request_id)[0]
+ # If we remove the state right away, it will not be included with
+ # the result fo the service call (current design limitation).
+ # Instead, we will set it to configured to give as feedback but delete
+ # it shortly after so that it is deleted when the client updates.
self.hass.states.set(entity_id, STATE_CONFIGURED)
- # If we remove the state right away, it will not be included with
- # the result fo the service call (limitation current design).
- # Instead we will set it to configured to give as feedback but delete
- # it shortly after so that it is deleted when the client updates.
- threading.Timer(
- .001, lambda: self.hass.states.remove(entity_id)).start()
+ def deferred_remove(event):
+ """ Remove the request state. """
+ self.hass.states.remove(entity_id)
+
+ self.hass.bus.listen_once(EVENT_TIME_CHANGED, deferred_remove)
def handle_service_call(self, call):
""" Handle a configure service call. """
diff --git a/homeassistant/components/http/frontend.py b/homeassistant/components/http/frontend.py
index df97ffe708..efddb97878 100644
--- a/homeassistant/components/http/frontend.py
+++ b/homeassistant/components/http/frontend.py
@@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """
-VERSION = "f299ce624d1641191f6f6a9b4b4d05bc"
+VERSION = "d44fb74a23d83756ed92d5d55f4d81ea"
diff --git a/homeassistant/components/http/www_static/frontend.html b/homeassistant/components/http/www_static/frontend.html
index 7129040444..bf2aebfa5e 100644
--- a/homeassistant/components/http/www_static/frontend.html
+++ b/homeassistant/components/http/www_static/frontend.html
@@ -50,7 +50,7 @@ if(this.removeAttribute(a),d)return j(this,a,c);var e=c,f=m(this,a,e);return j(t
It looks like we have nothing to show you right now. It could be that we have not yet discovered all your devices but it is more likely that you have not configured Home Assistant yet.
Please see the Getting Started section on how to setup your devices.
@@ -83,13 +84,13 @@ if(this.removeAttribute(a),d)return j(this,a,c);var e=c,f=m(this,a,e);return j(t
Setting {{stateObj.attributes.next_setting | relativeHATime}}
+
+
+
+
+
+
+
diff --git a/homeassistant/components/http/www_static/polymer/cards/state-card-content.html b/homeassistant/components/http/www_static/polymer/cards/state-card-content.html
index e0335394df..c27d5f07e8 100644
--- a/homeassistant/components/http/www_static/polymer/cards/state-card-content.html
+++ b/homeassistant/components/http/www_static/polymer/cards/state-card-content.html
@@ -3,6 +3,7 @@
+
diff --git a/homeassistant/components/http/www_static/polymer/dialogs/more-info-dialog.html b/homeassistant/components/http/www_static/polymer/dialogs/more-info-dialog.html
index f89cee05e6..bdc77b394e 100644
--- a/homeassistant/components/http/www_static/polymer/dialogs/more-info-dialog.html
+++ b/homeassistant/components/http/www_static/polymer/dialogs/more-info-dialog.html
@@ -36,7 +36,6 @@ Polymer({
/**
* Whenever the attributes change, the more info component can
* hide or show elements. We will reposition the dialog.
- * DISABLED FOR NOW - BAD UX
*/
reposition: function(oldVal, newVal) {
// Only resize if already open
diff --git a/homeassistant/components/http/www_static/polymer/home-assistant-api.html b/homeassistant/components/http/www_static/polymer/home-assistant-api.html
index aeffc74cf1..901b0e444a 100644
--- a/homeassistant/components/http/www_static/polymer/home-assistant-api.html
+++ b/homeassistant/components/http/www_static/polymer/home-assistant-api.html
@@ -39,7 +39,7 @@