xoseperez / node-red-contrib-power-monitor

A Node-RED node to monitor home appliances based on their power consumption.
Other
21 stars 16 forks source link

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

Input

Two valid input options:

Output

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

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.