nodesimulator
v0.0.7
Published
nodesimulator CLI
Downloads
2
Readme
nodesimulator CLI
A CLI for nodesimulator.
Installing
sudo npm i -g nodesimulator
configuration
Create the configuration file
sudo mkdir -p /etc/nodesimulator/
sudo touch /etc/nodesimulator/nodesimulator.yaml
Although it is possible to provide all configuration options on the commandline, it is easier to make some configurations in /etc/nodesimulator/nodesimulator.yaml
. For this you can use this template:
sysAdmin:
username: [email protected]
password: examplePwd
server: "https:/exampleHost.com"
If you get a yaml error, please just copy the template above and replace the values.
Downloading data
Please be sure to first create /usr/share/nodesimulator/data
or run as root to have the directory created. You may also have to run as root if the directory is owned by root, which will be the case if the directory is created by root.
You can download data from a single device, a list of devices or all devices for a customer.
For a single device, use: nodesimulator download -T TenantName -D deviceName
For a several devices, use: nodesimulator download -T TenantName -D device1Name,device2Name,..,deviceNName
For all devices, use: nodesimulator download -T TenantName -C CustomerName -D "*"
. (-D
is optional though).
download [-S server -U systemAdmin -P systemAdminPwd if not in /etc/nodesimulator/nodesimulator] -T tenant [-D device default is ("*") if -C is included so that all devices for customer. Separate list of devices with ,] [-B start Date default (2018-01-01/earliest date for device) -E end date default now]
upload
To upload data:
- go to
cd /usr/share/nodesimulator/data
- rename the file containing the data you want to upload to have the name of the device you want to upload to:
cp OLDDEVICENAME NEWDEVICENAME
. Ignore this if you are uploading to the same device from which the data was downloaded.
You can upload data from a single device, a list of devices or all devices for a customer.
For a single device, use: nodesimulator upload -T TenantName -D deviceName -F field1,field2,...,fieldN
For a several devices, use: nodesimulator upload -T TenantName -D device1Name,device2Name,..,deviceNName -F field1,field2,...,fieldN
For all devices, use: nodesimulator upload -T TenantName -C CustomerName -D "*" -F field1,field2,...,fieldN
. (-D
is optional though). This will rarely be of any important use
Note: If you use -f
when uploading, then all data for the device will be deleted. If you'd like to filter fields or duration for which you want data to be deleted, then use nodesimulator delete
upload [-S server -U systemAdmin -P systemAdminPwd if not in /etc/nodesimulator/nodesimulator] -T tenant [-D device default is ("*") if -C is included so that all devices for customer. Separate list of devices with ,] [-B start Date default (earliest date for device) -E end date default now -F fields to upload defaults to "*" for all fields -f force deletion of all existing data for device before uploading new data -d delayMs - interval at which data is uploaded to allow for rule chains to process. defaults to 100 -O deletes data from device and stops there]
NOTE: The server is not able to handle very frequent requests. So we recommend that you use a delay of 800 ms and more when uploading.
delete
USE WITH CAUTION. You may end up deleting all data for all devices of a tenant account
If you need to delete data from a device, you can use:
nodesimulator delete -T WaterMeasurements -D testPrepaidMeter -F "volume,amount,valveState"
To delete all fields, use -F "*"
or leave it out.
You can delete data for several devices using -D device1Name,device2Name,..,deviceNName
You can also select the range for which you want the data deleted by supplying -B begin
and -E end
otherwise the range is from the earliest entry to the last.