npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iv2go-simulator

v0.11.0

Published

## Prerequisites

Downloads

4

Readme

OSAA iV2GO Device Simulator

Prerequisites

You must have access to a working IoT Central application.

Installation

Clone the repository

git clone [email protected]:NordicodeApS/osaa-device-simulator.git

Change directory:

cd osaa-device-simulator

Install packages:

npm install

Start the watcher while developing:

npm run dev

Build:

npm run build

Symlink the binary (globally):

npm link

Usage

Run the following command to see a list of options:

iv2go-simulator --help

Example:

iv2go-simulator -d [device ID] -k [device key] -s [ID scope] -m [model ID] -i 30

Note: if you get a "permission denied" error, you might need to make the js file executable.
You can do this by running: chmod +x dist/index.js

Device key

The simulator connections to IoT Central by using the Shared access signature method.

The device key is specific for the device and is generated with the following console command:

az extension add --name azure-iot # if not already installed
az iot central device compute-device-key --primary-key <enrollment group primary key> --device-id <device ID>

You might need to install the Azure CLI for the command to work

The enrollment group primary key is the primary key of the Shared access signature of an enrollment group (also called Device connection group) that uses the SAS attestation type.

Read more: https://learn.microsoft.com/en-gb/azure/iot-central/core/concepts-device-authentication#sas-enrollment-group

Environment variables

If you find you're using the same values for idScope and modelId over and over again, or you don't want to compute device keys all the time, consider creating a .env file with some general values.

If you want to leave out the deviceKey option and instead generate a device key on-the-fly, add this variable:

DEVICE_GROUP_KEY=<enrollment group primary key>

You can also leave out the idScope and modelId options and instead add these variables:

DEVICE_ID_SCOPE=<ID scope>
DEVICE_MODEL_ID=<model ID>

If you add all the env variables above, you can launch a simulator simply by running:

iv2go-simulator -d [device ID]

Here is a list of all available environment variables and options:

| Key | Option | Default | Description | | --- | --- | --- | --- | | DEVICE_ID | -d | (empty) | The device ID | | DEVICE_KEY | -k | (empty) | The computed device key (read more) | | DEVICE_ID_SCOPE | -s | (empty) | ID scope | | DEVICE_MODEL_ID | -m | (empty) | Template model ID | | DEVICE_GROUP_KEY | | (empty) | Enrollment group primary key (read more) | | INTERVAL | -i | 30 | How often to send messages (in seconds) | | DURATION | -t | 3600 | Treatment duration | | FLOWRATE | -f | 75 | The flowrate in ml/h | | LOOP | -l | false | If the treatment should loop | | | -q | false | Suppress output

Build Docker image

docker build -t iv2go-simulator:<tag> .
docker tag iv2go-simulator:<tag> <registry-endpoint>/iv2go-simulator:<tag>
docker push <registry-endpoint>/iv2go-simulator:<tag>