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

node-red-contrib-device-manager

v1.0.4

Published

A group of nodes including Button, Dimmer, and Virtual for actuator & sensor access.

Downloads

28

Readme

Device Manager Node set

A group of nodes including Button, Dimmer, and Virtual for actuator & sensor access.

Motivation Behind This Project

There are many automation solutions available: OpenHAB, OpenNetHome, Nest, and many others. All of them are fine solutions for home automation. But I didn't feel like they gave me enough control; that is, there were no simple plugins for historical data, or complex scheduling, or simple PID controllers that satisfied me.

Besides that, I also wanted something that would transform as needed. For example, I'd like to automate fish-tank management & a winter greenhouse vegetable garden, and I'd like both to have unique interfaces related to their purpose - a kind of functional theme.

After looking at much of what is available, I decided that Node-RED was a reasonable foundation to build upon. Aditionally, I wanted to only use one language - ECMAScript (aka: javascript) - for the front end and the back end. Beyond that, I wanted to create my own devices using actuators & sensors.

The Intended Setup

I have decided to use Espressif's ESP32 chips for their low cost and availability. One can pick up a development board for less than $5 on AliExpress, and less than $10 on Amazon.

Because switching programing languages can be burdensome, I have used Espruino, which enables javascript on microcontrollers. It supports a wide range of MCUs, and has provided wonderful support for the ESP line (ESP32 & ESP8266). This project does not particularly care what language you program your MCU in, so long as WebSockets are implemented and the "OctoProtocol" is used.

An example device for monitoring pH, EC & water temperature is in the Water Module repository.

What You Get

This module provides 4 nodes. They consist of:

  1. a Device Manager, which will manage WebSocket connections and provides the i/o between the device and Node-RED;
  2. a Button, which provides a simple interface to On/Off services;
  3. a Dimmer providing read access to analog devices & write access to PWMs or DACs;
  4. a Virtual, which provides access to user-defined devices that might return multiple values or complex objects.

These provide an abstract way of interacting with a device, without needing to know a lot about it. An example setup might be:

|Device |Type |Output | |-----------|---------|-----------------------------------------------------| |bme280 |virtual |{ payload: [ "reading" { device: "bme280", value: { Temperature: 25, Humidity: 45, Preassure: 965.5 }}]}| |Lamp | button | { payload: [ "state", { device: "Lamp", value: { state: true }}]} | |Lamp Dimmer| dimmer | { payload: [ "state", { device: "Lamp", value: { state: 75 }}]} |

Descriptions of the Nodes

Device Manager

A node that provides configuration access for the functional nodes (button, dimmer, virtual). It provides a WebSocket for devices to connect to, routes messsages to individual nodes, etc. It supports running along with Node-RED, or on another user-defined port. For user-defined ports, no path is necessary in the configuration. For Node-RED managed WebSocket, a path is required and multiple paths may be provided by separating them with a comma.

Button

A node that connects to a GPIO on an embedded device, sending on or off commands.

The device should return a "state", (e.g. {state: 1} for ON, & {state: 0} for OFF)

Dimmer

A node that sets output of a PWM/DAC or other analog output / input peripheral.

The device should return a "state" e.g. {state: 79} would indicate the PWM/Analog is at 79%

Virtual

A node that sends a predefined string (e.g. "getState", or "getTemperature") to the device, whereupon the device responds with the result of the command via a reading packet containing an object with the results & possibly meta data about the results (e.g. Temperature, or Air Preassure units, etc.)

Example flow

An example flow can be found here