Wakoma / nimble

The nimble. An open source, rapidly deployable, wireless mesh network.
CERN Open Hardware Licence Version 2 - Strongly Reciprocal
66 stars 10 forks source link

shelf_id Bug #95

Open jmwright opened 3 weeks ago

jmwright commented 3 weeks ago

The code here in device.py that gets the shelf_builder_id is supposed to just strip a trailing -6 or -st, but it seems to incorrectly force some shelf IDs to be generic.

The following JSON in devices.json leads to a generic shelf.

{"ID": "Western_Digital_Red_HDD","Type": "Storage","Hardware": "Western Digital Red HDD","Brand": "Western Digital", "Model": "WD20EFAX","Shelf": "HDD 3.5 Shelf","Rack": "6 in","ShelfId": "hdd35","HeightUnits": "2","LengthMm": "147.07 mm","Depth": "101.60 mm","Height": "26.16 mm","PoEIn": "","PoEOut": "","WattageMax": "","EstCostUsd": "$131.00","ProductWebsiteUsd": "","ProductWebsiteEur": "https://www.amazon.de/-/en/Western-Digital-Internal-Hard-Drive/dp/B083XVY99B/ref=sr_1_5","RAM": "","Field19": "","PoEInInputVoltage": "","Voltage": "","Amperage": "","WRTVersion": "","OpenWRTLink": "","Comments": "Part number is for the 2TB version"}

Whereas adding a -6 to the ShelfId fixes the issue.

{"ID": "Western_Digital_Red_HDD","Type": "Storage","Hardware": "Western Digital Red HDD","Brand": "Western Digital", "Model": "WD20EFAX","Shelf": "HDD 3.5 Shelf","Rack": "6 in","ShelfId": "hdd35-6","HeightUnits": "2","LengthMm": "147.07 mm","Depth": "101.60 mm","Height": "26.16 mm","PoEIn": "","PoEOut": "","WattageMax": "","EstCostUsd": "$131.00","ProductWebsiteUsd": "","ProductWebsiteEur": "https://www.amazon.de/-/en/Western-Digital-Internal-Hard-Drive/dp/B083XVY99B/ref=sr_1_5","RAM": "","Field19": "","PoEInInputVoltage": "","Voltage": "","Amperage": "","WRTVersion": "","OpenWRTLink": "","Comments": "Part number is for the 2TB version"}

@julianstirling

julianstirling commented 3 weeks ago

This is legacy code. Currently the way it works is that it has to match the regex, which involves the -6 but then the -6 is stripped off.

I think having the shelf_id in the database itself is the problem. Because it splits the thinking, and means we have to update both the database and the cad to update how we build for a shelf.

The database should tell us what the hardware is. If we have made a shelf that can accept that hardware the the CAD side should know this. As we have said before we really need to have a think about what data actually belongs in the database.

jmwright commented 3 weeks ago

@julianstirling So for now since I am trying to get the assemblies working, should I just add the -6?

julianstirling commented 3 weeks ago

Yeah I think that's best