Skip to content

Energy Manager IoT

  • Efficient Energy Management Optimize power usage in IoT devices

  • Device Management Centralized registry with unique IDs and flexible grouping

  • MQTT Communication Reliable messaging with reconnection support

  • Group Analytics Statistical insights across device groups

Introduction

Energy Manager IoT is a comprehensive Node.js library designed for efficient management of IoT devices through the MQTT protocol, with a focus on energy optimization. The library provides a robust foundation for building IoT applications that need to monitor and control energy usage across multiple devices.

Key Features

  • Robust MQTT Connectivity: Reliable communication with automatic reconnection support
  • Device Management: Register and track devices with unique IDs and customizable properties
  • Command System: Send commands to individual devices or groups (e.g., "sleep", "wake")
  • Status Monitoring: Receive and store device status (e.g., battery level, power mode)
  • Group Analytics: Calculate statistics like average battery level across device groups
  • TypeScript Support: Full TypeScript with strong typing for development confidence
  • Professional Logging: Structured logging with contextual tracking and correlation IDs
  • Comprehensive Error Handling: Categorized errors with severity levels and details

Installation

npm install energy-manager-iot

Quick Start

import { EnergyManager, DeviceType, CommandType } from 'energy-manager-iot';

// Create a manager instance
const manager = new EnergyManager();

// Connect to the MQTT broker
await manager.connect('mqtt://localhost:1883');

// Register devices
manager.registerDevice('sensor1', 'Temperature Sensor', DeviceType.SENSOR);
manager.registerDevice('light1', 'Smart Light', DeviceType.ACTUATOR);

// Create a group and add devices to it
manager.createGroup('living-room');
manager.addDeviceToGroup('sensor1', 'living-room');
manager.addDeviceToGroup('light1', 'living-room');

// Send a command to all devices in the group
await manager.sendCommandToGroup('living-room', CommandType.SET_REPORTING, { interval: 300 });

Ready to get started? Check out our quick start guide for more details!

Support

If you encounter any issues or need help, please open an issue on our GitHub repository.