mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Debug interface: added domain icons to services
This commit is contained in:
parent
c84cb86c87
commit
2226f8b6a9
@ -114,10 +114,18 @@ DOMAIN_ICONS = {
|
|||||||
"wemo": "glyphicon-hdd",
|
"wemo": "glyphicon-hdd",
|
||||||
"device_tracker": "glyphicon-phone",
|
"device_tracker": "glyphicon-phone",
|
||||||
"chromecast": "glyphicon-picture",
|
"chromecast": "glyphicon-picture",
|
||||||
"process": "glyphicon-barcode"
|
"process": "glyphicon-barcode",
|
||||||
|
"browser": "glyphicon-globe",
|
||||||
|
"homeassistant": "glyphicon-home",
|
||||||
|
"downloader": "glyphicon-download-alt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _get_domain_icon(domain):
|
||||||
|
return "<span class='glyphicon {}'></span>".format(
|
||||||
|
DOMAIN_ICONS.get(domain, ""))
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, api_password, server_port=None, server_host=None):
|
def setup(hass, api_password, server_port=None, server_host=None):
|
||||||
""" Sets up the HTTP API and debug interface. """
|
""" Sets up the HTTP API and debug interface. """
|
||||||
server_port = server_port or rem.SERVER_PORT
|
server_port = server_port or rem.SERVER_PORT
|
||||||
@ -379,15 +387,12 @@ class RequestHandler(BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
domain = util.split_entity_id(entity_id)[0]
|
domain = util.split_entity_id(entity_id)[0]
|
||||||
|
|
||||||
icon = "<span class='glyphicon {}'></span>".format(
|
|
||||||
DOMAIN_ICONS.get(domain, ""))
|
|
||||||
|
|
||||||
attributes = "<br>".join(
|
attributes = "<br>".join(
|
||||||
"{}: {}".format(attr, val)
|
"{}: {}".format(attr, val)
|
||||||
for attr, val in state.attributes.items())
|
for attr, val in state.attributes.items())
|
||||||
|
|
||||||
write("<tr><td>{}</td><td>{}</td><td>{}".format(
|
write("<tr><td>{}</td><td>{}</td><td>{}".format(
|
||||||
icon, entity_id, state.state))
|
_get_domain_icon(domain), entity_id, state.state))
|
||||||
|
|
||||||
if state.state == STATE_ON or state.state == STATE_OFF:
|
if state.state == STATE_ON or state.state == STATE_OFF:
|
||||||
if state.state == STATE_ON:
|
if state.state == STATE_ON:
|
||||||
@ -421,15 +426,16 @@ class RequestHandler(BaseHTTPRequestHandler):
|
|||||||
# Describe bus/services:
|
# Describe bus/services:
|
||||||
write(("<div class='row'>"
|
write(("<div class='row'>"
|
||||||
"<div class='col-xs-6'>"
|
"<div class='col-xs-6'>"
|
||||||
"<div class='panel panel-primary'>"
|
"<div class='services panel panel-primary'>"
|
||||||
"<div class='panel-heading'><h2 class='panel-title'>"
|
"<div class='panel-heading'><h2 class='panel-title'>"
|
||||||
" Services</h2></div>"
|
" Services</h2></div>"
|
||||||
"<table class='table'>"
|
"<table class='table'>"
|
||||||
"<tr><th>Domain</th><th>Service</th></tr>"))
|
"<tr><th></th><th>Domain</th><th>Service</th></tr>"))
|
||||||
|
|
||||||
for domain, services in sorted(
|
for domain, services in sorted(
|
||||||
self.server.hass.services.services.items()):
|
self.server.hass.services.services.items()):
|
||||||
write("<tr><td>{}</td><td>".format(domain))
|
write("<tr><td>{}</td><td>{}</td><td>".format(
|
||||||
|
_get_domain_icon(domain), domain))
|
||||||
|
|
||||||
write(", ".join(
|
write(", ".join(
|
||||||
"<a href='#' data-service='{0}/{1}'>{1}</a>".format(
|
"<a href='#' data-service='{0}/{1}'>{1}</a>".format(
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
@import url(//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap.min.css);
|
@import url(//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap.min.css);
|
||||||
|
|
||||||
.states td .glyphicon {
|
.states td .glyphicon, .services td .glyphicon {
|
||||||
margin-top: 3px;
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.states td:nth-child(1) {
|
.states td:nth-child(1), .services td:nth-child(1) {
|
||||||
width: 22px;
|
width: 22px;
|
||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user