Ki-nTree
Ki-nTree copied to clipboard
Part parameters not being added at part creation
I'm adding some parts using the Digi-Key supplier option. I have parameters mapped and I'm finding that the parameters are not being added when the part is being created. However, once the part is created, and I run an Update on the IPN to update parameters, the parameters are added.
Here's the output from a part I ran:
[MAIN] Generating Internal Part Number
[INFO] Internal Part Number = TRA-0091-0000
[INFO] Success: Added new part to InvenTree
[INFO] Warning: Image download failed (HTTP Error)
[MAIN] Creating parameters
[TREE] Error: Parameter template "Technology" does not exist
[TREE] Warning: The following parameters were skipped:
---> Collector Gate Voltage
---> ECCN
---> Frequency
---> Function Type
---> Gain (hFE)
---> Mounting Type
---> Package Type
---> Packaging
---> Rated Current
---> Rated Power
---> Rated Voltage
---> Temperature Range
---> Value
---> Maximum Gate Voltage
---> RDS On Resistance
---> Technology
[MAIN] Creating manufacturer part
[INFO] Success: Added new manufacturer part
[MAIN] Creating supplier part
[INFO] Success: Added new supplier part
[MAIN] Processing Price Breaks
[INFO] Success: The price breaks were updated
[MAIN] Opening URL https://[REMOVED]/part/TRA-0091-0000/ in browser
[TREE] Successfully connected to InvenTree server (ENV=DEVELOPMENT)
[MAIN] Searching for original part in database
[INFO] Success: Found original part in database (ID = 91 | Description = "BJT TO92 80V NPN 0.625W 150C")
[INFO] Warning: The following parameters were not found in supplier data:
['Vgs (Max)', 'Rds On (Max) @ Id, Vgs', 'Technology']
[INFO] The following parameters are not mapped in Digi-Key parameters configuration:
['Package / Case']
[MAIN] Creating parameters
[TREE] Error: Parameter template "Technology" does not exist
[INFO] Success: The following parameters were updated:
---> Collector Gate Voltage
---> ECCN
---> Frequency
---> Function Type
---> Gain (hFE)
---> Mounting Type
---> Package Type
---> Packaging
---> Rated Current
---> Rated Power
---> Rated Voltage
---> Temperature Range
---> Value
[TREE] Warning: The following parameters were skipped:
---> Maximum Gate Voltage
---> RDS On Resistance
---> Technology
[MAIN] Creating manufacturer part
[INFO] Manufacturer part already exists, skipping.
[MAIN] Creating supplier part
[INFO] Supplier part already exists, skipping.
[MAIN] Processing Price Breaks
[INFO] Success: The price breaks were updated
Nothing else was done between creating the part, and Updating the part params.
I'm running Ki-nTree version 1.0.0-dev (from what it says in GUI). I downloaded the latest from Github and installed it with the Poetry instructions. Somehow I had installed it with pip, and I got a version that said it was version 1.1.0, but I can't seem to figure out how to get it again from Github.
InvenTree version is 0.15.3 API version 196 Python version 3.11.9 Django version 4.2.12
I had this same problem today (I think), based on the line:
"[TREE] Error: Parameter template "Technology" does not exist"
The name of the library "Technology" has to have parameters in the "supplier_parameters.yaml"
i.e. If I create a symbol library named "SoMs" I have to also "map" the symbol field names to the supplier parameter names in the "supplier_parameters.yaml" as follows (example, do not try):
SoMs:
Supply Power:
- Module Supply Power (Watts)
Interfaces:
- Interface Connections
The main issue here is that you have the Parameter Technology mapped in your supplier_parameters.yaml but you don't have a matching parameter template in your inventree database, so this parameter gets skipped as intended.
The other parameters, at least the ones which are in the supplier data, seem to be created as expected, because your second run does not report them being created but instead being updated, so they were already created in the first run. For some reason I do not understand rn they get sorted into the wrong list after the creation and therefore get reported as skipped instead of created.
Using the repo configuration, I can't reproduce:
[MAIN] Digi-Key search for MPSA06
[TREE] Successfully connected to InvenTree server (ENV=DEVELOPMENT)
[INFO] Warning: The following parameters were not found in supplier data:
['Vgs (Max)', 'Rds On (Max) @ Id, Vgs']
[INFO] The following parameters are not mapped in Digi-Key parameters configuration:
['Packaging', 'Package / Case', 'Mounting Type', 'Current - Collector Cutoff (Max)', 'DC Current Gain (hFE) (Min) @ Ic, Vce', 'Frequency - Transition', 'ECCN']
[MAIN] Generating Internal Part Number
[INFO] Internal Part Number = TRA-000059-00
[INFO] Success: Added new part to InvenTree
[INFO] Warning: Image download failed (HTTP Error)
[MAIN] Creating parameters
[TREE] Error: Parameter template "Collector-Gate Voltage" does not exist
[INFO] Success: The following parameters were created:
---> Function Type
---> Package Type
---> Rated Current
---> Rated Power
---> Rated Voltage
---> Temperature Range
---> Value
---> Maximum Gate Voltage
---> RDS On Resistance
[TREE] Warning: The following parameters were skipped:
---> Collector-Gate Voltage
@hillsandales Could you please share your supplier_parameters.yaml? If you have made changes there maybe that'll help us figure this one out.
Here's my supplier_parameters.yaml file. I had added a lot of parameters and changed around categories in Inventree from the default config. Maybe I should have kept it simple...
I'm a little unclear on what each config file does. categories.yaml makes sense and the supplier_parameters.yaml is starting to make sense. For the supplier categories, I thought each supplier had to have its settings put into a separate file like digikey was but then I read through the docs carefully and found a sentence or something that noted only Digikey works for a file like digikey_categories.yaml.
I've been developing a fork of Ki-nTree to add another supplier's "API" (not really, more like LCSC's method) so I've been through the source code a lot more now than a week ago and trying to wrap my head around all the config files.
I'm still unclear on what each setting does in the
Base:
Number of Contacts:
- Number of Terminations
Packaging:
- Packaging
Temperature Range:
- Operating Temperature
Capacitors:
ESR:
- ESR (Equivalent Series Resistance)
Package Height:
- Height - Seated (Max)
- Thickness (Max)
Package Size:
- Size / Dimension
Rated Voltage:
- Voltage - Rated
- Voltage Rated
Temperature Grade:
- Temperature Coefficient
Temperature Range:
- Operating Temperature
Tolerance:
- Tolerance
Value:
- Capacitance
parent:
- Base
Circuit Protections:
Breakdown Voltage:
- Voltage - Breakdown (Min)
Capacitance:
- Capacitance @ Frequency
Clamping Voltage:
- Voltage - Clamping (Max) @ Ipp
Rated Current:
- Current Rating (Amps)
- Current - Max
Rated Power:
- Power - Peak Pulse
Rated Voltage:
- Voltage Rating - DC
- Voltage - Max
Standoff Voltage:
- Voltage - Reverse Standoff (Typ)
Value:
- Manufacturer Part Number
parent:
- Base
Connectors:
Features:
- Features
Frequency:
- Frequency - Max
Interface Type:
- Connector Type
- Flat Flex Type
Locking:
- Locking Feature
- Fastening Type
Mating Height:
- Mated Stacking Heights
Mounting Type:
- Mounting Type
Number of Contacts:
- Number of Contacts
- Number of Positions
Number of Rows:
- Number of Rows
Orientation:
- Orientation
Package Height:
- Height Above Board
- Insulation Height
Pitch:
- Pitch
- Pitch - Mating
Polarity:
- Gender
Shielding:
- Shielding
Temperature Range:
- Operating Temperature
Value:
- Manufacturer Part Number
Crystals and Oscillators:
Frequency Stability:
- Frequency Stability
Frequency Tolerance:
- Frequency Tolerance
Load Capacitance:
- Load Capacitance
Package Height:
- Height - Seated (Max)
Package Size:
- Size / Dimension
Rated Current:
- Current - Supply (Max)
Rated Voltage:
- Voltage - Supply
Value:
- Frequency
parent:
- Base
Diodes:
Forward Voltage:
- Voltage - Forward (Vf) (Max) @ If
- Voltage - Forward (Vf) (Typ)
- Vf - Forward Voltage
Function Type:
- Diode Type
- Type
Rated Current:
- Current - Average Rectified (Io)
Rated Power:
- Power - Max
Rated Voltage:
- Voltage - DC Reverse (Vr) (Max)
- Voltage - Zener (Nom) (Vz)
- Vr - Reverse Voltage
Temperature Range:
- Operating Temperature - Junction
Value:
- Manufacturer Part Number
- ManufacturerPartNumber
parent:
- Base
Inductors:
ESR:
- DC Resistance (DCR)
- DC Resistance (DCR) (Max)
Package Height:
- Height - Seated (Max)
- Height (Max)
Package Size:
- Size / Dimension
Rated Current:
- Current Rating (Max)
- Current Rating (Amps)
Saturation Current:
- Current - Saturation
Shielding:
- Shielding
Value:
- Inductance
- Impedance @ Frequency
parent:
- Base
- Passives
Integrated Circuits:
Frequency:
- Clock Frequency
- Speed
- Data Rate
- Frequency Range
- -3db Bandwidth
Function Type:
- Translator Type
- Technology
- Core Processor
- Type
- Sensor Type
Memory Size:
- Program Memory Size
- Memory Size
Number of Channels:
- Channels per Circuit
Rated Voltage:
- Voltage - VCCA
- Voltage - VCCB
- Voltage - Supply
- Voltage - Supply (Vcc/Vdd)
- Voltage - Supply, Digital
- Voltage - Supply, Single (V+)
Value:
- Manufacturer Part Number
parent:
- Base
LED:
LED Color:
- Color
Package Type:
- Supplier Device Package
parent:
- Diodes
Mechanicals:
Function Type:
- Circuit
- Type
Mounting Type:
- Mounting Type
- Features
Package Height:
- Between Board Height
Package Size:
- Outline
- Diameter - Outside
Package Type:
- Screw, Thread Size
Rated Current:
- Contact Rating @ Voltage
Value:
- Manufacturer Part Number
parent:
- Base
NPN:
parent:
- Transistors
Power Management:
(Min) Output Voltage:
- Voltage - Output (Min/Fixed)
Frequency:
- Frequency - Switching
Function Type:
- Topology
Max Input Voltage:
- Voltage - Input (Max)
Max Output Voltage:
- Voltage - Output (Max)
Min Input Voltage:
- Voltage - Input (Min)
Output Type:
- Output Type
Package Type:
- Supplier Device Package
Quiescent Current:
- Current - Quiescent (Iq)
Rated Current:
- Current - Output
Value:
- Manufacturer Part Number
parent:
- Base
RF:
Frequency:
- Frequency Range
Function Type: null
Rated Voltage: null
Value:
- Manufacturer Part Number
parent:
- Base
Resistors:
Composition:
- Composition
ECCN:
- ECCN
Failure Rate:
- Failure Rate
Features:
- Features
Footprint:
- Footprint
Package Height:
- Height - Seated (Max)
Package Type:
- Supplier Device Package
Rated Power:
- Power (Watts)
Resistance:
- Resistance
Size:
- Size / Dimension
Symbol:
- Symbol
Temperature Coefficient:
- Temperature Coefficient
Temperature Range:
- Operating Temperature
Tolerance:
- Tolerance
Value:
- Resistance
Standard:
Package Type:
- Package / Case
parent:
- Diodes
Transistors:
Collector Gate Voltage:
- Vce Saturation (Max) @ Ib, Ic
- Vgs(th) (Max) @ Id
ECCN:
- ECCN
Frequency:
- Frequency - Transition
Function Type:
- Transistor Type
- FET Type
Gain (hFE):
- DC Current Gain (hFE) (Min) @ Ic, Vce
Maximum Gate Voltage:
- Vgs (Max)
Mounting Type:
- Mounting Type
Package Type:
- Supplier Device Package
Packaging:
- Packaging
RDS On Resistance:
- Rds On (Max) @ Id, Vgs
Rated Current:
- Current - Collector (Ic) (Max)
- "Current - Continuous Drain (Id) @ 25\xB0C"
- Current - Collector Cutoff (Max)
Rated Power:
- Power - Max
- Power Dissipation (Max)
Rated Voltage:
- Voltage - Collector Emitter Breakdown (Max)
- Drain to Source Voltage (Vdss)
Technology:
- Technology
Temperature Range:
- Operating Temperature
Value:
- Manufacturer Part Number
@hillsandales please check if you have the Technology part parameter template in InvenTree and if not either add it or remove the parameter from your transistor configuration in the supplier_parameters.yaml. This should at least solve the cause for your error (not for the bug reporting the other parameters wrongly as not created)
Adding "Technology" as a parameter in Inventree fixed that problem. Parameters still need to be written as a second action after the part is initially created it seems.
@hillsandales have you checked if the parameters are there in Inventree after the first run already and are only wrongly shown as skipped?
@T0jan I setup a fresh setup at work, and started populating params from scratch. It does seem like the parameters are not written when the part is created. The terminal shows this but I checked the InvenTree parameters on the website, and they're not populated. Running it again and Updating the part with the part number writes the parameters, both indicating in the terminal and also appears on the Inventree site.
I'm starting to wrap my head around all the config files and how they setup what is sent to InvenTree, so it's possible I still have something mis-configured, but this fresh setup is much cleaner and I'm adding categories, parameters, and such slowly and trying to check things as I add them.
Hello @hillsandales I tried again and failed to find any issue with parameters. The setup_inventree script should take care of creating templates while the GUI should be able to add them to each created parts on the first try.
If you get an error like:
[MAIN] Creating parameters
[TREE] Error: Parameter template "(Min) Output Voltage" does not exist
This either means:
- the "(Min) Output Voltage" template is not in your
parameters.yaml, you need to add it there and re-run thesetup_inventreescript to create the template - the
supplier_parameters.yamlfile maps to an incorrect parameter template (here "(Min) Output Voltage" name was wrong as the template name is "Min Output Voltage", no parenthesis).
If you do get an error like:
[MAIN] Creating parameters
[TREE] Error: Failed to create part parameter "Frequency".
[TREE] Error: Parameter value "Up to 2MHz" is not allowed by server settings.
You'll need to edit the parameter value prior to add the part in InvenTree, from:
to:
Then the output should show:
[MAIN] Creating parameters
[INFO] Success: The following parameters were created:
---> Frequency
And the parameter be added to your part in InvenTree:
I will close this ticket for now, if you still have difficulties, please re-open it and copy the Ki-nTree log here.