diff --git a/homeassistant/components/http/__init__.py b/homeassistant/components/http/__init__.py index 50bce72d51b..c648708225a 100644 --- a/homeassistant/components/http/__init__.py +++ b/homeassistant/components/http/__init__.py @@ -106,6 +106,16 @@ URL_CALL_SERVICE = "/call_service" URL_STATIC = "/static/{}" +DOMAIN_ICONS = { + "sun": "glyphicon-asterisk", + "group": "glyphicon-th-large", + "charging": "glyphicon-flash", + "light": "glyphicon-hdd", + "wemo": "glyphicon-hdd", + "device_tracker": "glyphicon-phone", + "chromecast": "glyphicon-picture" +} + def setup(hass, api_password, server_port=None, server_host=None): """ Sets up the HTTP API and debug interface. """ @@ -357,7 +367,7 @@ class RequestHandler(BaseHTTPRequestHandler): "
" "" - "" + "
" "" "" "").format(self.server.api_password)) @@ -366,11 +376,17 @@ class RequestHandler(BaseHTTPRequestHandler): sorted(self.server.hass.states.all().items(), key=lambda item: item[0].lower()): - attributes = "
".join( - ["{}: {}".format(attr, state.attributes[attr]) - for attr in state.attributes]) + domain = util.split_entity_id(entity_id)[0] - write("" "" diff --git a/homeassistant/components/http/www_static/style.css b/homeassistant/components/http/www_static/style.css index f0ebb98c271..2f99154ff5d 100644 --- a/homeassistant/components/http/www_static/style.css +++ b/homeassistant/components/http/www_static/style.css @@ -4,6 +4,11 @@ margin-top: 3px; } +.states td:nth-child(1) { + width: 22px; + padding-right: 0px; +} + .states td:nth-child(3) { max-width: 550px; word-break: break-word;
Entity IDStateAttributesLast Changed
{}{}".format(entity_id, state.state)) + icon = "".format( + DOMAIN_ICONS.get(domain, "")) + + attributes = "
".join( + "{}: {}".format(attr, val) + for attr, val in state.attributes.items()) + + write("
{}{}{}".format( + icon, entity_id, state.state)) if state.state == STATE_ON or state.state == STATE_OFF: if state.state == STATE_ON: @@ -387,7 +403,7 @@ class RequestHandler(BaseHTTPRequestHandler): attributes, util.datetime_to_str(state.last_changed))) # Change state form - write(("