This package can be used to deploy an IoT device simulator on your local machine. Can be used in conjunction with SDS to build demo's and prototypes.
Check out this demo video right here: example no SDS
-
First of all install nodejs from the following location: Node.js
Download the stable version (recommended for most users). Follow the Wizard.
To test if everything is working, open a command prompt and type (if you already had a prompt open, close it first):
$ node --version
If you get an error, uninstall and install again.
-
Download Git from following location: Git
Follow the wizard (When asked if you want to add to your path, click yes).
To test if everything is working, open a command prompt and type (if you already had a prompt open, close it first):
$ git --version
If you get an error, uninstall and install again.
-
Download and install mongodb from the following location (only needed of you want to stream to other things outside SDS):
- for Mac: with homebrew or installer
- for Windows: mongodb for windows
Check to see if you can run mongod from the command prompt.
-
Navigate to a folder on your local machine where you want to store the application.
-
Open a command prompt and navigate to that specific folder (to get the path, just copy paste it from the finder window):
$ cd <path/to/folder> // omit the <>
-
Clone the project into the folder iot-device-simulator and move into the folder on the command Prompt:
$ git clone https://github.com/Temmermans/iot-device-simulator.git iot-device-simulator && cd iot-device-simulator
-
Install all the necessary libs via the following command:
$ npm install
-
Start the local server with the following command:
$ npm run dev
-
a) For Mac, start the mongodb service with following command in another command prompt:
$ mongod
b) For windows, go to your root c:/ and add a folder called 'data' and in that folder a folder called 'db' (mongodb does not create those automatically). Start the mongodb service by navigating to the bin folder of your mongodb installation in a command prompt and typing (or add the bin folder to your env variables):
$ mongod
-
Navigate to the following url on the localhost: localhost
If you an access-Control-Allow-Origin error install following chrome extension: Allow-Control-Allow-Origin and enable it, make sure the icon is green and then try again. If using other sites, makes sure to turn it off again.
The control panel has the option to adjust the values while streaming of the attributes you entered. For numeric values you will see a slider. For booleans and categorical values you see a dropdown. This is useful for when you want to demo certain events in your streaming logic. Also, the nudge button provides the possibility to simulate a sudden event. For example a door that opens for a short period of time or a package that gets bumped.
Demo video coming soon
For SDS projects, provide the necessary details in the SDS panel. With the correct credentials, you should see data coming in in the windows of yout SDS project.
Check out this demo video right here: example no SDS
If you skip the SDS project, the app will start streaming data to the following endpoint: /simulator/data as JSON. This can then be consumed by a front end tool capable of doing REST requests. Keep in mind that to use this, you will need to install mongodb on your local machine. (see above).
Every time you press the stop streaming button, the db will be flushed, to avoid taking up to much space when streaming regularly.
- Form Validation
- Styling
- Use electron to create a native desktop app
- Use iterator and generators for the stream?
- ...
Contributions and ideas are more than welcome!