node-red-contrib-z2m

1.1.0 • Public • Published

node-red-contrib-z2m

A collection on Node-RED nodes interfacing with Zigbee2MQTT.

Inspired by node-red-contrib-zigbee2mqtt with following key differences:

  • Written in (mostly) Typescript
  • Uses built-in Node-RED MQTT configuration nodes
  • Uses the new Zigbee2MQTT API

A word of caution

This project is work in progress and might be subject to change dramatically.

Right now, it lives in "personal pet project" status, which I do use to automate my home with, so you can expect some stability :)

Example

Currently, only few nodes are available:

example-flow.png

View source: example-flow.json

Quickstart

See Node-RED docs about how to install nodes using NPM or package.json

But in the gist it is just:

# Navigate to node-red userDir (yours might differ!)
cd $HOME/.node-red

# Install this package
npm install node-red-contrib-z2m

# Restart Node-RED!

Developer quickstart

# Clone this repository
git clone https://github.com/kristianheljas/node-red-contrib-zigbee2mqtt
cd node-red-contrib-zigbee2mqtt

# Install dependencies (also installs husky git hooks)
yarn

# Compile sources (--dev enables sourceMaps, useful for debugging)
yarn build --dev

# Install this repository locally
cd /path/to/node-red-user-dir
npm install /path/to/node-red-contrib-zigbee2mqtt

To automatically watch for file changes run yarn gulp watch instead (also supports --dev flag)

Development server

You can run integrated node-red devlopment server by running yarn gulp start, which will:

  1. Compile all sources & copy static assets
  2. Run node-red development server
  3. Automatically compile and restart the server on file changes

By default the development server listens on port 1880, but can be configured via PORT enviroment variable (ie. PORT=8080 yarn gulp start).

The development server stores it's data and configuration inside .node-red/ directory.

Development

# Start local node-red instance & watch for file changes
yarn gulp start

## EDIT SOURCES ##

# Commit changes
git add .
git commit # runs lint-staged and commitlint automatically

# Push changes
git push

You can also run linting and formatting manually using:

# Fix eslint problems
yarn lint

# Format code using prettier
yarn format

Convetional commits

This project is enforcing Conventional Commits.

@commitlint/config-conventional conguration is used, which is based on the Angular convention.

Quick examples

  • feat: new feature
  • fix(scope): bug in scope
  • feat!: breaking change in API
  • chore(deps): update dependencies

Commit types

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Changes wich doesn't change source code or tests e.g. chnages to the build process, auxiliary tools, libraries
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Revert something
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

Versions

Current Tags

Version History

Package Sidebar

Install

npm i node-red-contrib-z2m

Weekly Downloads

12

Version

1.1.0

License

MIT

Unpacked Size

324 kB

Total Files

53

Last publish

Collaborators

  • kristianheljas