The code is written in TypeScript and then transpiled into JavaScript. For more information on creating Node-RED nodes, see the official Creating Nodes Overview.
The following instructions assume that development is done on a modern Linux system.
After cloning the Git repository, all further instructions assume that you are in the root of the source directory, which is likely called node-red-contrib-pac.
After cloning the repository to your computer, you need to install the dependencies by running:
npm install
Also, grunt-cli must be installed:
sudo npm install -g grunt-cli
To build the JavaScript files from the TypeScript source, run:
grunt
You can also clean out all the output files with:
grunt clean
In order for your development version of the PAC Control nodes to be used by Node-RED, you need to link your source directory into the local npm system. Run:
sudo npm link
There are two types of tests you can run: with or without a physical controller.
To run just the internal unit tests without a device, run:
grunt test-internal
Running all tests requires the following:
- An EPIC or SNAP PAC controller with:
- (SNAP PAC only) 9.5 or greater firmware.
- REST API configured for HTTP or HTTPS access, and at least one API key.
- Running the PAC Control Basic strategy named NodeRedTester, which is located in the test/pac folder.
- A local copy of the settings.json file.
- From within ts/test/exernal, copy settings.json.tmpl to settings.json.
- Adjust the file to use your device's address and API key.
To run all the tests, run:
grunt test-all