npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@equans/smart-buildings-occupancy

v2.1.0

Published

Node-Red block for occupancy strategy

Downloads

4

Readme

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