A simple Node.JS daemon that listens for published events on your Particle event stream, parses them, and pushes them to Initial State.
- Clone this repository
- Change to repo directory (
npm installto install dependencies
- Run using
node particle-initialstate.jsor use any process manager (nodemon, foreverjs, pm2)
Options are now set via environment variables. Available options are:
ACCESS_TOKEN- (Required) Your Particle cloud access token
IS_TOKEN- (Required) Your Initial State access token
EVENT_NAME- The name of the event to listen for - default:
0= Disable, Any other value = Enable - default:
SPARK_PATH- The metric path prefix for
spark/*events - default:
IS_BUCKET- The Initial State bucket to store these metrics
Data format is:
device name- (Optional) If not specified with a name (followed by a semi-colon), the Particle device ID will be used instead.
metric name- The name of the metric you wish to record. Keep it short so you can fit more data in a single publish.
metric value- The value of the metric you wish to record.
metric type- The StatsD metric type to use.
Multiple metrics can be passed as long as each metric set (
metric value, and
metric type) is separated by commas.
Note that this keeps the same format as the particle-statsd repo so it's easier to switch amongst the two (or run them simultaneously).