Clean up
This commit is contained in:
parent
9cf9bc11d3
commit
e8d6057264
@ -124,8 +124,7 @@ def showEntities(query):
|
|||||||
|
|
||||||
entity_query_list = query.string.split()
|
entity_query_list = query.string.split()
|
||||||
|
|
||||||
|
# Query entities from HASS
|
||||||
# query entities from HASS
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(config["state_query"], headers=config["headers"])
|
response = requests.get(config["state_query"], headers=config["headers"])
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
@ -193,7 +192,7 @@ def showEntities(query):
|
|||||||
entity["state"].capitalize()
|
entity["state"].capitalize()
|
||||||
)
|
)
|
||||||
|
|
||||||
# build item for list
|
# Build item for list
|
||||||
item = Item(id=__title__,
|
item = Item(id=__title__,
|
||||||
icon=entity_icon,
|
icon=entity_icon,
|
||||||
text=entity["attributes"]["friendly_name"],
|
text=entity["attributes"]["friendly_name"],
|
||||||
@ -201,7 +200,7 @@ def showEntities(query):
|
|||||||
subtext="%s | %s" % (state_colored, entity_class.capitalize())
|
subtext="%s | %s" % (state_colored, entity_class.capitalize())
|
||||||
)
|
)
|
||||||
|
|
||||||
# add actions depending on class
|
# Add actions depending on class
|
||||||
if entity_class in toggle_types:
|
if entity_class in toggle_types:
|
||||||
item.addAction(FuncAction("Toggle", lambda d=data: sendCommand(d, "homeassistant/toggle")))
|
item.addAction(FuncAction("Toggle", lambda d=data: sendCommand(d, "homeassistant/toggle")))
|
||||||
|
|
||||||
@ -220,7 +219,7 @@ def showEntities(query):
|
|||||||
|
|
||||||
results.append(item)
|
results.append(item)
|
||||||
|
|
||||||
# no entity found
|
# No entity found
|
||||||
if len(results) == 0:
|
if len(results) == 0:
|
||||||
results.append(
|
results.append(
|
||||||
Item(id=__title__,
|
Item(id=__title__,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user