Energy Management Local Communications Protocol Node.JS SDK

This node module allows you to experiment with the Energy Management Local
Communications Protocol, or EMLCP, to query and control EM Devices, or, in
the context of this documentation EM Nodes, and provides an example
implementation leveraging best practices.
Release Status
This Node.JS SDK, while a useful example of leveraging the protocol and utilizing
best practices for common workflows, should be considered in an Alpha state and
not suitable for production applications. However, the SDK is open-source and
contributions to enhance the state of the SDK are encouraged!
Overview and Terminology
Relevant Documentation can be found at:
Terminology:
- EMLCP: Energy Management Local Communications Protocol
- EM Node: A generic name for an EM Device (including EMCBs) on the local
network
- EM Coordinator: A name for the coordinator that is utilizing the EM Local
Communications Protocol to
communicate with EM Nodes on the local network (this Node.JS SDK serves as an
EM Coodinator)
NOTE: The implementation utilizes Emcb
and EMCB
as a prefix for several
entities and constants, such as EmcbUDPbroadcastCoordinator
and
EMCB_UDP_MESSAGE_CODE_GET_DEVICE_STATUS
, and this will be updated to use more
generic EmNode
and EM_LCP
terminology throughout in a later release.
Installation
npm
npm install --save emcb-udp-coordinator
Manual
git clone https://github.com/EatonEM/emcb-udp-coordinator
cd emcb-udp-coordinator
npm install
Logging
This SDK exposes a pre-configured
winston@3
logger
. It also overrides console.log
, etc. so that
all logs are captured by winston.
These logs are written to both the console and to ./logs/
whenever the
emcb-udp-coordinator
is used to aid in debugging/understanding. See
docs/api.md for more information.
Requirements
You will need the following installed in your environment:
- Node.js and npm (Node Package Manager)
- git
This library was last updated on macOS using node v20.9.0. (It was originally developed and tested on macOS using node v10.14.3)
v16 or greater of Node.js is required.
Git
git
should be available in your $PATH
as npm
might need it. You can find
git at https://git-scm.com/.
Node
Node installation on Windows
The official Node.js website has an installer available
for download.
Node installation on macOS
For macOS, the preferred installation method is to use nvm (Node Version
Manager). You can install nvm and the
latest version of node using these commands:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
$ nvm install v20
$ nvm use v20
$ nvm alias v20 default
Node installation on Ubuntu
You can install nodejs and npm easily with apt install, just run the following
commands:
$ sudo apt install nodejs
$ sudo apt install npm
Other Operating Systems
You can find more information about the installation on the official Node.js
website and the official NPM
website.
If the installation was successful, you should be able to run the following
command and get your version output
$ node --version
$ npm --version
If you need to update npm
, you can make it using npm
! After running the
following command, simply reopen your terminal
$ npm install npm -g