async def websocket_release_notes( hass: HomeAssistant, connection: websocket_api.connection.ActiveConnection, msg: dict, ) -> None: """Get the full release notes for a entity.""" component = hass.data[DOMAIN] entity: UpdateEntity | None = component.get_entity(msg["entity_id"]) if entity is None: connection.send_error( msg["id"], websocket_api.const.ERR_NOT_FOUND, "Entity not found" ) return if not entity.supported_features & UpdateEntityFeature.RELEASE_NOTES: connection.send_error( msg["id"], websocket_api.const.ERR_NOT_SUPPORTED, "Entity does not support release notes", ) return connection.send_result( msg["id"], await entity.async_release_notes(), )
def websocket_handle_reorder( hass: HomeAssistant, connection: websocket_api.connection.ActiveConnection, msg: dict, ) -> None: """Handle reordering shopping_list items.""" msg_id = msg.pop("id") try: hass.data[DOMAIN].async_reorder(msg.pop("item_ids")) hass.bus.async_fire(EVENT, {"action": "reorder"}, context=connection.context(msg)) connection.send_result(msg_id) except KeyError: connection.send_error( msg_id, websocket_api.const.ERR_NOT_FOUND, "One or more item id(s) not found.", ) except vol.Invalid as err: connection.send_error(msg_id, websocket_api.const.ERR_INVALID_FORMAT, f"{err}")