Skip to content

Commit

Permalink
Merge remote-tracking branch 'official/master' into github
Browse files Browse the repository at this point in the history
  • Loading branch information
decentlab committed May 7, 2024
2 parents b437532 + 68b1d41 commit 43e055d
Show file tree
Hide file tree
Showing 294 changed files with 1,297 additions and 723 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Closes #0000, References #0000, etc.
- [ ] Title and description should be descriptive (Not just a serial number for example).
- [ ] `profileIDs` should not be `vendorID` and should be a unique value for every profile.
- [ ] All devices should be listed in the vendor's `index.yaml` file.
- [ ] Firmware versions can not be changed.
- [ ] At least 1 image per device and should be transparent.

#### Notes for Reviewers
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ fmt:
devices.csv:
$(NODE) bin/csv.js

setup:
bin/setup.sh

# vim: ft=make
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ To use the YAML plugin correctly, you need to assign the schema to the plugin. T
}
```

## Setup script

To help you get started with adding vendors and devices to the repo we made a script that creates all the necessary files with some basic information. To run the script, open a terminal (preferably inside a code editor like VSCode) and enter:

```bash
$ make setup
```
After that just follow the instructions given to you by the script.

## Files and Directories

There are six file types in the Device Repository:
Expand Down
5 changes: 3 additions & 2 deletions bin/csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const extractData = (filePath, vendor) => {
const name = data.name;
const vendorname = vendorNamesMap.get(vendor) || vendor; // Fallback to the vendor ID if no name is found
const description = data.description.replace(/"/g, "'");
const deviceType = data.deviceType || '';
const sensors = Array.isArray(data.sensors) ? `"${data.sensors.join(', ')}"` : '';
const imageUrl = data.photos?.main ? `"${baseUrl}/${vendor}/${data.photos.main}"` : '';
const additionalRadios = Array.isArray(data.additionalRadios) ? `"${data.additionalRadios.join(', ')}"` : '';
Expand Down Expand Up @@ -76,7 +77,7 @@ const extractData = (filePath, vendor) => {
});
});

return `"${id}","${name}","${vendorname}","${description}",${imageUrl},${sensors},${additionalRadios},${height},${width},${length},${weight},"${ipCode}","${battery_replace}","${battery_type}","${productURL}","${dataSheetURL}","${highestMacVersion}",${regionalParametersVersion},${supportsClassB},${supportsClassC}\n`;
return `"${id}","${name}","${vendorname}","${description}",${imageUrl},${sensors},${deviceType},${additionalRadios},${height},${width},${length},${weight},"${ipCode}","${battery_replace}","${battery_type}","${productURL}","${dataSheetURL}","${highestMacVersion}",${regionalParametersVersion},${supportsClassB},${supportsClassC}\n`;
}
} catch (e) {
console.error(`Failed to process ${filePath}: ${e}`);
Expand All @@ -103,7 +104,7 @@ const walkSync = (dir, vendor = '', csvContent = '') => {

// Initialize CSV data
let csvHeader =
'ID,Name,Vendor,Description,Image,Sensor,Radios,Height,Width,Length,Weight,IP Rating,Battery Replaceable?,Battery Type,Product URL,Datasheet URL,MAC Version,Regional Parameter Version,Supports Class B?, Supports Class C?\n';
'ID,Name,Vendor,Description,Image,Sensor,Device Type,Radios,Height,Width,Length,Weight,IP Rating,Battery Replaceable?,Battery Type,Product URL,Datasheet URL,MAC Version,Regional Parameter Version,Supports Class B?, Supports Class C?\n';
let csvData = walkSync(startPath);

// Save to CSV file
Expand Down
Loading

0 comments on commit 43e055d

Please sign in to comment.