Avoid references to websocket_api.const in core and other components (#119285)

This commit is contained in:
epenet
2024-06-10 13:49:44 +02:00
committed by GitHub
parent 2e3c3789d3
commit 960d1289ef
25 changed files with 49 additions and 63 deletions

View File

@@ -1648,9 +1648,7 @@ class PipelineStorageCollectionWebsocket(
try:
await super().ws_delete_item(hass, connection, msg)
except PipelinePreferred as exc:
connection.send_error(
msg["id"], websocket_api.const.ERR_NOT_ALLOWED, str(exc)
)
connection.send_error(msg["id"], websocket_api.ERR_NOT_ALLOWED, str(exc))
@callback
def ws_get_item(
@@ -1664,7 +1662,7 @@ class PipelineStorageCollectionWebsocket(
if item_id not in self.storage_collection.data:
connection.send_error(
msg["id"],
websocket_api.const.ERR_NOT_FOUND,
websocket_api.ERR_NOT_FOUND,
f"Unable to find {self.item_id_key} {item_id}",
)
return
@@ -1695,7 +1693,7 @@ class PipelineStorageCollectionWebsocket(
self.storage_collection.async_set_preferred_item(msg[self.item_id_key])
except ItemNotFound:
connection.send_error(
msg["id"], websocket_api.const.ERR_NOT_FOUND, "unknown item"
msg["id"], websocket_api.ERR_NOT_FOUND, "unknown item"
)
return
connection.send_result(msg["id"])