{"id":680,"date":"2024-03-15T23:19:50","date_gmt":"2024-03-15T22:19:50","guid":{"rendered":"https:\/\/labparvum.com\/?p=680"},"modified":"2025-05-26T19:22:46","modified_gmt":"2025-05-26T19:22:46","slug":"electronics-inventory-system-v2-inventree","status":"publish","type":"post","link":"https:\/\/labparvum.com\/index.php\/2024\/03\/15\/electronics-inventory-system-v2-inventree\/","title":{"rendered":"Electronics inventory system V2 &#8211;  Inventree"},"content":{"rendered":"\n<p>Any person working with electronics, either for hobby or professionally will have a large assortment of components and parts laying around.<br>I\u2019d encourage anyone that will keep any kind of inventory of parts to invest some time in creating a system to keep track of the components you have, the location, and the ability to attach information and documents.<\/p>\n\n\n\n<p>I was already using Partkeepr  as described in a <a href=\"https:\/\/robinpeeten.com\/electronics-inventory-system-partkeepr\/\" data-type=\"URL\" data-id=\"https:\/\/robinpeeten.com\/electronics-inventory-system-partkeepr\/\">previous post<\/a><\/p>\n\n\n\n<p>I  switched over to <a href=\"https:\/\/inventree.org\/\" data-type=\"URL\" data-id=\"https:\/\/inventree.org\/\">Inventree<\/a> because Partkeepr has gone stale and is not being maintained anymore.<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Partkeepr to Inventree data transfer &amp; problems<\/h2>\n\n\n\n<p>There is a <a href=\"https:\/\/github.com\/rgilham\/PK2InvenTree\" data-type=\"URL\" data-id=\"https:\/\/github.com\/rgilham\/PK2InvenTree\">pluging\/script<\/a> to  transfer the data from partkeepr to inventree, sadly this one is outdated and not maintained at the time im writing this.<\/p>\n\n\n\n<p>Luckily Frank Steinberg provided a great python script I was able to use to transfer all my data from <a href=\"https:\/\/gitlab.ibr.cs.tu-bs.de\/steinb\/partkeepr-to-inventree\" data-type=\"URL\" data-id=\"https:\/\/gitlab.ibr.cs.tu-bs.de\/steinb\/partkeepr-to-inventree\">Partkeepr to Inventree<\/a>.<\/p>\n\n\n\n<p>Unfortunatly it did not work on the first try, but with some modification I was able to  get it to work for me.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">401  Unauthorized<\/h3>\n\n\n\n<p>My main issue from the start was the program kept crashing without a clear reason. by adding a printline  I saw kept getting a 401 response when  requesting data from partkeepr.  I had to put in my credentials at the correct locations for the HTTP requests. only putting the credentials into the url at the top of the script did not work for me.<\/p>\n\n\n\n<p><a href=\"https:\/\/pypi.org\/project\/requests\/\" data-type=\"URL\" data-id=\"https:\/\/pypi.org\/project\/requests\/\">Here<\/a> you can find more info about the HTTP request package and how to  use  it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"906\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2024\/03\/image-1.png\" alt=\"\" class=\"wp-image-682\" style=\"width:606px;height:626px\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2024\/03\/image-1.png 877w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/03\/image-1-290x300.png 290w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/03\/image-1-768x793.png 768w\" sizes=\"auto, (max-width: 877px) 100vw, 877px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code has-extra-small-font-size\"><code>def getFromPartkeepr(url, base, auth):\n\n    full_url = f'{base}{url}?itemsPerPage=100000'\n    r = requests.get(full_url, auth=('admin', 'admin'))\n    print(r)\n    if (r.status_code == 200):\n        return r.json()&#091;\"hydra:member\"]\n    return None\n\n\n\ndef getImageFromPartkeepr(url, base, auth, filename=\"image\"):\n\n    full_url = f'{base}{url}\/getImage'\n    r = requests.get(full_url, auth=('admin', 'admin'), stream=True)\n\n    if (r.status_code == 200):\n        r.raw.decode_content = True\n        tmp = tempfile.NamedTemporaryFile(delete=False, suffix=\"f-%s\" % (filename))\n        shutil.copyfileobj(r.raw, tmp)\n        return tmp.name\n    return None\n\n\ndef getFileFromPartkeepr(url, base, auth, filename=\"file\"):\n\n    full_url = f'{base}{url}\/getFile'\n    r = requests.get(full_url, auth=('admin', 'admin'), stream=True)\n\n    if (r.status_code == 200):\n        r.raw.decode_content = True\n        path = f'\/tmp\/{filename}'\n        f = open(path, 'wb')\n        shutil.copyfileobj(r.raw, f)\n        f.close()\n        return path\n    return None<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Keyerror: 18<\/h3>\n\n\n\n<p>I kept getting a keyerror because my root catagory did not  have a parent, fixed this by adding a exception catch to ignore the lack of a parrent.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"882\" height=\"462\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2024\/03\/image.png\" alt=\"\" class=\"wp-image-681\" style=\"width:701px;height:366px\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2024\/03\/image.png 882w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/03\/image-300x157.png 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/03\/image-768x402.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code has-extra-small-font-size\"><code>category_map = {} # mapped by @id\n    for category in categories:\n        id = int(category&#091;'@id'].rpartition(\"\/\")&#091;2])\n        if category&#091;\"parent\"]:\n            parent_id = int(category&#091;\"parent\"]&#091;\"@id\"].rpartition(\"\/\")&#091;2])\n            try:\n                parent_pk = category_map&#091;parent_id]\n            except KeyError:\n                pass\n        else:\n            parent_pk = None\n        if verbose:\n            print(f'create PartCategory \"{category&#091;\"name\"]}\", parent:{parent_pk}')\n        icategory = create(PartCategory, inventree, {\n            'name': category&#091;\"name\"],\n            'description': category&#091;\"description\"],\n            'parent': parent_pk,\n            })\n        category_map&#091;id] = icategory.pk<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Features<\/h2>\n\n\n\n<p>InvenTree is an open-source inventory management system which provides intuitive parts management and stock control. A wide range of features makes InvenTree the perfect choice for businesses and hobbyists alike. InvenTree is designed to be extensible, and provides multiple options for integration with external applications or addition of custom plugins.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Showcase<\/h3>\n\n\n\n<p>Parts dashboard:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"498\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-1024x498.png\" alt=\"\" class=\"wp-image-689\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-1024x498.png 1024w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-300x146.png 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-768x374.png 768w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-1536x747.png 1536w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-2048x996.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Stock locations<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"498\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-2-1024x498.png\" alt=\"\" class=\"wp-image-691\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-2-1024x498.png 1024w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-2-300x146.png 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-2-768x373.png 768w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-2-1536x747.png 1536w, https:\/\/labparvum.com\/wp-content\/uploads\/2024\/07\/image-2-2048x996.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Storage places<\/h2>\n\n\n\n<p>I currently use 3 storage methods.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>organizing drawers<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151903061-scaled-1-1024x768.jpg\" alt=\"\" class=\"wp-image-579\" style=\"width:333px;height:250px\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151903061-scaled-1-1024x768.jpg 1024w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151903061-scaled-1-300x225.jpg 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151903061-scaled-1-768x576.jpg 768w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151903061-scaled-1-1536x1152.jpg 1536w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151903061-scaled-1-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Tic Tac boxes<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" data-id=\"581\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151622471-scaled-1-1024x768.jpg\" alt=\"\" class=\"wp-image-581\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151622471-scaled-1-1024x768.jpg 1024w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151622471-scaled-1-300x225.jpg 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151622471-scaled-1-768x576.jpg 768w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151622471-scaled-1-1536x1152.jpg 1536w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151622471-scaled-1-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" data-id=\"580\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151623351-scaled-1-1024x768.jpg\" alt=\"\" class=\"wp-image-580\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151623351-scaled-1-1024x768.jpg 1024w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151623351-scaled-1-300x225.jpg 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151623351-scaled-1-768x576.jpg 768w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151623351-scaled-1-1536x1152.jpg 1536w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG202307151623351-scaled-1-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" data-id=\"578\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634271-scaled-1-1024x768.jpg\" alt=\"\" class=\"wp-image-578\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634271-scaled-1-1024x768.jpg 1024w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634271-scaled-1-300x225.jpg 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634271-scaled-1-768x576.jpg 768w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634271-scaled-1-1536x1152.jpg 1536w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634271-scaled-1-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Jewelry boxes for small items<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634161-scaled-1-1024x768.jpg\" alt=\"\" class=\"wp-image-577\" style=\"width:558px;height:419px\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634161-scaled-1-1024x768.jpg 1024w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634161-scaled-1-300x225.jpg 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634161-scaled-1-768x576.jpg 768w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634161-scaled-1-1536x1152.jpg 1536w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/IMG_20230715_1634161-scaled-1-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">ESD safety<\/h2>\n\n\n\n<p>To protect some electronic components from ESD damage I try to keep in mind how I store them. Although not as often as I should..<\/p>\n\n\n\n<p>To properly protect against ESD you need a storage box or bag that is below a certain surface resistance to dissipate the charge.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&lt;10^3\u03a9 = shielding<\/li>\n\n\n\n<li>&lt;10^4\u03a9 = conductive<\/li>\n\n\n\n<li>10^4\u03a9 -&gt; 10^11\u03a9 = static disipative<\/li>\n\n\n\n<li>&gt;10^11\u03a9 = insulative (not ESD safe)<\/li>\n<\/ul>\n\n\n\n<p>Source: ANSI\/ESD S541<br>these numbers vary a bit between sources, ANSI,ISO,IEC<\/p>\n\n\n\n<p>The Tic Tac boxes I use are made of PP (polypropylene).<br>PP has a surface resistance of 10^13 and does not meet ESD requirements because of this.<br>I put ESD-sensitive parts in an extra anti-static bag or stick them on esd foam, and then put it in the tic-tac box for easy storage and cataloging. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"181\" src=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/image-13-1024x181.png\" alt=\"\" class=\"wp-image-573\" srcset=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/image-13-1024x181.png 1024w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/image-13-300x53.png 300w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/image-13-768x136.png 768w, https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/image-13.png 1198w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div data-wp-interactive=\"core\/file\" class=\"wp-block-file\"><object data-wp-bind--hidden=\"!state.hasPdfPreview\" hidden class=\"wp-block-file__embed\" data=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/ElectricalPropertiesofPlastics.pdf\" type=\"application\/pdf\" style=\"width:100%;height:600px\" aria-label=\"Embed of ElectricalPropertiesofPlastics.\"><\/object><a id=\"wp-block-file--media-ccb948a0-76d5-410b-8f84-a30149f73597\" href=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/ElectricalPropertiesofPlastics.pdf\">ElectricalPropertiesofPlastics<\/a><a href=\"https:\/\/labparvum.com\/wp-content\/uploads\/2023\/07\/ElectricalPropertiesofPlastics.pdf\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-ccb948a0-76d5-410b-8f84-a30149f73597\">Download<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Any person working with electronics, either for hobby or professionally will have a large assortment of components and parts laying around.I\u2019d encourage anyone that will keep any kind of inventory of parts to invest some time in creating a system to keep track of the components you have, the location,<\/p>\n<p><a href=\"https:\/\/labparvum.com\/index.php\/2024\/03\/15\/electronics-inventory-system-v2-inventree\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Electronics inventory system V2 &#8211;  Inventree<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":696,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7],"tags":[],"class_list":["post-680","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics","category-homelab"],"_links":{"self":[{"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/posts\/680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/comments?post=680"}],"version-history":[{"count":2,"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"predecessor-version":[{"id":781,"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/posts\/680\/revisions\/781"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/media\/696"}],"wp:attachment":[{"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labparvum.com\/index.php\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}