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-power-monitor

v1.2.3

Published

A Node-RED node to monitor home appliances based on their power consumption.

Downloads

637

Readme

node-red-contrib-power-monitor

GitHub version NPM version Dependencies Status donate twitter

A Node-RED node to monitor home appliances based on their power consumption.


Table of Contents


Install

Run the following command in your Node-RED user directory - typically ~/.node-red:

npm install node-red-contrib-power-monitor

Usage

Feed the node regularly with a real number as payload representing the average consumption in Watts since the last message. The node will trigger events based on the start and stop conditions with additional information like the total energy consumption for the last cycle.

Notice

Latest version (1.0.0) is not backwards compatible with previous ones (0.X.X). The most important change is that we have just one output for all the different events instead of 2 outputs for start and stop events. Therefore, you will have to add a switch node the the output to filter the type of message you want to process using the event property of the payload object. You can use the same node to redirect different type of events to different sub-flows.

Configuration

  • Name: Name of the appliance. Will be attached to the output object.
  • Start threshold: Value (in watts) to tell whether the appliance is running, an ideal value would be 0 (0W if not running).
  • Start after: Number of messages with readings over the threshold to trigger a start event.
  • Stop threshold: Value (in watts) to tell whether the device has finished, an ideal value would be 0 (0W if not running).
  • Stop after: Number of messages with readings below the threshold to trigger a stop event.
  • Preserve msg properties: Use the input msg for output, putting the output JSON object into the "payload" property.

Input

Two valid input options:

  • The number of the average watts since last message.
  • Passing stop will force a stoppd state, overriding the Stop threshold and Stop after requirements.

Output

The output will be a JSON object with the device name and the event type.

  • In case the event is a pre_start or running event, it will also report the current running time (in seconds) and the current energy consumption of the cycle (in kWh) since it started, as well as the energy_delta in kWh since last update.
  • In case the event is a stop event, it will also report the total time (in seconds) and the total energy consumption of the cycle (in kWh).
  • The input power (Watts) and device name (the name you gave to this node) will always be fed to the output for every input. Knowing the power gives you the capability of discovering in which particular cycle a washing machine is in (ie: Washing, Draining, Rinse Cycle, etc). For a clothes dryer that contains a light bulb you can determine if someone opened the door to check the clothes as the power will drop to whatever wattage the light bulb is. Knowing this would allow you to write downline functions that could show paused for example.
  • The idle event allows downstream nodes to receive their first feed soon after a reboot.

Examples:

{ "name": "washer", "power": 8, "event": "start", "time": 0, "energy": 0, "energy_delta": 0 }

{ "name": "washer", "power": 8, "event": "pre_start", "time": 100, "energy": 0.003, "energy_delta": 0.002 }

{ "name": "washer", "power": 217, "event": "running", "time": 4500, "energy": 0.05, "energy_delta": 0.009 }

{ "name": "washer", "power": 0, "event": "stop", "time": 8800, "energy": 0.14, "energy_delta": 0.020 }

{ "name": "washer", "power": 0, "event": "idle" }

Suggestions

The ideal popular device to use to capture power is a Sonoff S-31 or POW running Espurna firmware (Tasmota probably too). Set it up to report power perhaps every 30 or 60 seconds.

Place a timer or countdown node just in front of the power-monitor node. Set it to perhaps 45 or 90 seconds so that it will send 0 or stop if nothing is received by the hardware power monitor device. This is useful when the power monitor loses power/is switched off while the power-monitor node is not in a idle state and node-red is still running. Without this countdown node power-monitor will continue to accumulate time and energy if it was in a running state at the time of power outtage. Note that the countown node must send out 0 or stop, 0 will adhear to the the Stop threshold and Stop after, passing stop will force a stopped state.

At the completion of a stop event it is a good time to write the total seconds etc to a database.

Contribute

There are several ways to contribute to this project. You can report bugs or ask for new features directly on GitHub. You can also submit your own new features of bug fixes via a pull request.

And of course you can always buy me a beer, coffee, tea,... via the donation button below.

donate

License

This project is licensed under Apache 2.0 license.