# node-red-contrib-load-balance-knapsack

> A Node-RED node that load balances electric consumption based on the knapsack algorithm.

Latest version **1.0.0** (published 2023-10-25) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install node-red-contrib-load-balance-knapsack
pnpm add node-red-contrib-load-balance-knapsack
yarn add node-red-contrib-load-balance-knapsack
bun add node-red-contrib-load-balance-knapsack
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-10-25 |
| First published | 2023-10-25 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 45.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Harshad Joshi |
| Maintainers | hj91 |
| Keywords | node-red, knapsack, load-balance, electric |

## Links

- npm: https://www.npmjs.com/package/node-red-contrib-load-balance-knapsack
- Repository: https://github.com/hj91/node-red-contrib-load-balance-knapsack
- Homepage: https://github.com/hj91/node-red-contrib-load-balance-knapsack#readme
- Issues: https://github.com/hj91/node-red-contrib-load-balance-knapsack/issues
- npm.io page: https://npm.io/package/node-red-contrib-load-balance-knapsack

## Recent versions

- 1.0.0 (latest) — 2023-10-25

## README

# node-red-contrib-load-balance-knapsack

A Node-RED node that load balances electric consumption based on the knapsack algorithm.

## Description

This node receives MQTT messages with topics representing gadget names and their associated electric consumption values as payloads. When a message with the topic `max_load_capacity` is received, the node calculates which gadgets can be turned on without exceeding the provided maximum capacity. The resulting payload will contain an array of gadget names that can be turned on within the max capacity.

## Installation

Install directly from your Node-RED's setting palette or:

```bash
npm install node-red-contrib-load-balance-knapsack
```

## Usage

1. Drag and drop the `load-balance-knapsack` node from the palette to your flow.
2. Connect MQTT nodes or other input nodes to feed electric consumption data.
3. Send a message with the topic `max_load_capacity` to trigger the load-balancing algorithm.
4. The node will output an array of gadget names that can operate within the given max capacity.

## Example Input

```json
{
  "topic": "kitchen/mixer",
  "payload": 30
}
```

To trigger the load balancing:

```json
{
  "topic": "max_load_capacity",
  "payload": 100
}
```

## Issues and Feedback

For any issues or feedback related to this node, please open an issue on the [GitHub repository](https://github.com/hj91/node-red-contrib-load-balance-knapsack/issues).

## Author

**Harshad Joshi**  
[GitHub](https://github.com/hj91)

## License

This project is licensed under the GPL-3.0 License - see the [LICENSE](LICENSE) file for details.

---
_Source: https://npm.io/package/node-red-contrib-load-balance-knapsack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
