Particle Device Constants
The static device identifiers and meta-data for Particle hardware.

Installation | Development | Releasing
Installation
- Install Node.js [
node@12.x
and npm@6.x
are required] - Clone this repository
$ git clone git@github.com:particle-iot-inc/device-constants.git && cd ./device-constants
- Install dependencies
$ npm install
- make sure you are signed into npm and a member of the
@particle
org (docs)
- View available commands
$ npm run
- Run the tests
$ npm test
- Start Hacking!
Development
The Device Constants repo contains static specs for official Particle platform devices and the tooling to support publishing a series of language-specific packages with that data. All essential commands are available via npm run <script name>
- e.g. npm run lint
. To view the available commands, run: npm run
How to add a new platform
To add a new Particle platform device, simply:
- Open the
src/constants.json
file in your favorite code editor - Add a new entry like:
"example": {
"id": <integer - the unique identifier>,
"name": <string - the unique name used by Device OS' build system>,
"displayName": <string - human-facing platform name>,
"generation": <integer - e.g. `2` for photon, `3` for boron>,
"features": <array of strings - the features supported e.g. `wifi`, `ble`>,
"billingConnectivity": <string for where data ops for this device type should be counted e.g. `wifi`, `cellular` or `asset_tracker`>,
"public": <boolean - whether or not the platform is available to end-users>
},
NOTE: See src/constants.schema.json
for latest field definitions
- Validate your additions adhere to the current schema:
npm run validate
- Stage and commit:
git add -p && git commit
How to extend the device schema
Constants data must adhere to the JSON Schema (https://json-schema.org) specs in src/constants.schema.json
. In some cases, you may need to extend the current schema to support addition properies, etc. To do that:
- Read through the "Getting Started" docs
- Open the
src/constants.schema.json
file in your favorite code editor - Update the schema with your additions or changes - in some cases, you can jumpstart the process using the online generator at: https://www.jsonschema.net but be sure to scrutinize what it provides as it's not always super-accurate :)
- Validate your changes have not rendered existing data invalid:
npm run validate
- Stage and commit:
git add -p && git commit
Releasing
Packages are only released from the main
branch after peer review.
- make sure you have the latest:
$ git checkout main
$ git pull
- make sure tests pass
- run the release command
- follow the on-screen instructions, wait for confirmation of success
- push your tags:
$ git push origin main --follow-tags