Change get_entity to return a extended entry, add inputs to de… (#32083)
* Change get_entity to return a extended entry + add inputs to default config For https://github.com/home-assistant/home-assistant-polymer/pull/4940 * Fix tests, simplify code, update to return extended Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
1 parent
edfb967b10
commit
fcaabb3d33
3 files changed
+33
-9
No files matched your search
@@ -57,7 +57,9 @@ async def websocket_get_entity(hass, connection, msg):
|
||||
)
|
||||
return
|
||||
|
||||
connection.send_message(websocket_api.result_message(msg["id"], _entry_dict(entry)))
|
||||
connection.send_message(
|
||||
websocket_api.result_message(msg["id"], _entry_ext_dict(entry))
|
||||
)
|
||||
|
||||
|
||||
@require_admin
|
||||
@@ -112,7 +114,7 @@ async def websocket_update_entity(hass, connection, msg):
|
||||
)
|
||||
else:
|
||||
connection.send_message(
|
||||
websocket_api.result_message(msg["id"], _entry_dict(entry))
|
||||
websocket_api.result_message(msg["id"], _entry_ext_dict(entry))
|
||||
)
|
||||
|
||||
|
||||
@@ -152,6 +154,15 @@ def _entry_dict(entry):
|
||||
"name": entry.name,
|
||||
"icon": entry.icon,
|
||||
"platform": entry.platform,
|
||||
"original_name": entry.original_name,
|
||||
"original_icon": entry.original_icon,
|
||||
}
|
||||
|
||||
|
||||
@callback
|
||||
def _entry_ext_dict(entry):
|
||||
"""Convert entry to API format."""
|
||||
data = _entry_dict(entry)
|
||||
data["original_name"] = entry.original_name
|
||||
data["original_icon"] = entry.original_icon
|
||||
data["unique_id"] = entry.unique_id
|
||||
data["capabilities"] = entry.capabilities
|
||||
return data
|
||||
Reference in new issue
Block a user