2.1.0 • Published 1 year ago

@equans/smart-buildings-occupancy v2.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

strategies-occupancy

Implementation

Overview

Occupancy sensing is the most common control method employed today for energy saving. Occupancy sensors automatically turn ON lights when people enter a space and turn them OFF (or Dim) shortly after people leave. They enable automated lighting control in enclosed offices, open workspaces, and shared amenity spaces.

This repo contains all the necessary code for a custom Node-Red block that implements occupancy sensing.

Strategy breakdown

The logic for the custom occupancy block can all be found within the strategies-occupancy.js file.

The block uses motion, detected at any of the connected mulitsenses' PIR sensors, to determine the state of the connected lights or light groups. An unlimited amount of multisenses can be connected to the block's inputs. Similarly, an unlimited of lights or light groups can be connected to the block's outputs.

Any time motion is detected at one of the block's inputs, the connected lights are immediately turned ON.

Whenever no motion is detected, a timer (set by the user) is triggered which then turns the lights OFF once the timeout expires.

Any motion detected during the timeout period will reset the timer and turn the lights ON until once again, no motion is detected.

Caveats and considerations

When determining which motion sensors should be triggering which lights, extra attention should be paid so that areas of a room are not being needlessly lit. Similarly, motion sensors should be placed in a way such that people are not having to travel across a space in order to trigger the lights.

Installation in Node-RED

The custom occupancy strategy is available as an npm module and can be installed by either seaching for the @equans/smart-buildings-occupancy within the node-red dashboard's manage palette menu or by adding:

RUN npm install @equans/smart-buildings-occupancy

to your node red Dockerfile (provided the you have a valid npm token within your .npmrc config file).

You can read more about installing custom node-red modules here and here

Development

Setup

  • Clone this repo to your local machine
  • run npm install to install all dependencies
  • If you havent already, download and install node-red using the instructions here
  • Within .npmrc replace $GITHUB_TOKEN with your github token for publishing changes to the package to github. Make sure you don't commit the token.
  • In order to publish changes to the npm registry, you must replace the $NPM_TOKEN with your npm token. Make sure you don't commit the token.

Running locally

  • Navigate to your node-red user directory (often ~/.node-red) and create a symbolic link with the strategies-occupancy repo by running:
    npm install <path to the repo>
  • Alternatively, you can create a symbolic link by navigating to the repo and running:
    npm link
  • Any changes to the repo require the node-red server to be restarted

Publishing the package

  • Instructions on preparing the package can be found here

  • In order to publish the package, make sure your .npmrc file contains a valid $NPM_TOKEN and then use the following command to publish the package:

    npm publish --access public
2.1.0

1 year ago

2.0.0

2 years ago

1.0.0

2 years ago