node-red-contrib-easy-device 1.0.2

A Node-RED node for easy IoT device management with platform integration support

npm install node-red-contrib-easy-device

node-red-contrib-easy-device

A Node-RED node for easy IoT device management that provides a simple way to manage Internet of Things devices with platform integration.

Features

  • Multi-device Support: Supports various IoT device types including lighting, air conditioning, sensors, and more
  • Multiple Protocols: Compatible with Modbus, UDP, TCP, Cross, and Zigbee 3.0 protocols
  • Flexible Communication: Supports RS485 and RJ45 communication channels
  • Device Discovery: Automatic device discovery and management capabilities
  • Group Control: Ability to control multiple devices simultaneously
  • Spatial Organization: Organize devices by space, floor area, and floor for better management
  • Action-based Control: Define custom actions for different device types

Installation

Via Node-RED Palette Manager

  1. Open Node-RED in your browser
  2. Go to the menu (≡) → Manage palette
  3. Click on the "Install" tab
  4. Search for node-red-contrib-easy-device
  5. Click "Install"

Via npm

npm install node-red-contrib-easy-device

Manual Installation

  1. Navigate to your Node-RED user directory (typically ~/.node-red)
  2. Run the installation command:
    npm install node-red-contrib-easy-device
    
  3. Restart Node-RED

Usage

Basic Setup

  1. Add the Easy Device Node: Drag the "easy-device" node from the device category to your flow
  2. Configure Device Host: Set up the device host configuration with IP and port
  3. Configure Spatial Information: Set space, floor area, and floor details
  4. Add Devices: Configure individual devices with their properties

Node Configuration

Device Host Configuration

  • Host: IP address of the device host
  • Port: Communication port (default: 1880)

Main Node Configuration

  • Name: Descriptive name for the node
  • Mac: MAC address of the gateway device
  • Device Host: Reference to the configured device host
  • Space: Spatial identifier for device organization
  • Floor Area: Floor area identifier
  • Floor: Floor identifier

Device Configuration

For each device, configure:

  • Code: Unique device identifier
  • Name: Human-readable device name
  • Area: Physical area where the device is located
  • Type: Device type (lighting, sensors, air conditioning, etc.)
  • Protocol: Communication protocol (Modbus, UDP, TCP, etc.)
  • Channel: Communication channel (RS485, RJ45)
  • Actions: Available actions for the device

Supported Device Types

Control Devices

  • Light: Basic lighting control (on/off/charge)
  • Adjustable Light: Dimmable lighting (on/off/adjust/charge)
  • Air Conditioning: Climate control (on/off/temperature/mode/fan/charge/alarm)
  • Air Cleaner: Air purification (on/off/fan)
  • Air Fan: Ventilation (on/off/fan)
  • Blind: Window covering (up/down/pause/charge)
  • Smart Pad: Interactive display (status/refresh/play/fullscreen/bind)

Sensor Devices

  • Air Sensor: Environmental monitoring (PM2.5, PM10, TVOC, CO2, formaldehyde, etc.)
  • Smoke Sensor: Fire detection (smoke/charge)
  • Human Sensor: Occupancy detection (presence/charge)
  • WC Sensor: Restroom occupancy (presence/charge)
  • Power Sensor: Electrical monitoring (voltage/current/power/kwh)
  • Water Sensor: Water usage monitoring (water/charge)
  • Inundation Sensor: Flood detection (inundation/charge)
  • AI Camera Sensor: Intelligent monitoring (density count/cross count/face recognition/smoking detection/duty detection)

Gateway Devices

  • Edge Gateway: Network management (reboot/backup flow/info)

Message Format

Input Messages

The node accepts messages with specific topic patterns:

  1. Device Discovery:

    {
      "topic": "/iot/discover",
      "payload": timestamp
    }
    
  2. Enhanced Discovery:

    {
      "topic": "/iot/yqdiscover",
      "payload": timestamp,
      "devices": [array_of_devices]
    }
    
  3. Device Action:

    {
      "topic": "/iot/action/{type}/{space}/{floorarea}/{floor}/{area}/{names}",
      "payload": action_data
    }
    

Output Messages

The node outputs structured messages containing:

  • topic: Original message topic
  • prepayload: Original payload
  • name: Node name
  • space: Space identifier
  • floorarea: Floor area identifier
  • floor: Floor identifier
  • gateway: Gateway MAC address
  • layers: Array of all easy-device node IDs
  • layer: Current node ID
  • devices: Array of configured devices
  • payload: Processed payload data

Output Ports

  1. Port 1: Device discovery responses
  2. Port 2: Group control responses
  3. Port 3+: Individual device responses (one port per configured device)

Examples

Basic Device Discovery

// Inject node payload
{
  "topic": "/iot/discover",
  "payload": 1706489007340
}

Control Specific Device Type

// Control all lights in a specific area
{
  "topic": "/iot/action/light/building1/floor2/room201/area1/light1",
  "payload": {
    "action": "on",
    "value": true
  }
}

Group Control

// Control multiple devices of the same type
{
  "topic": "/iot/action/light/building1/floor2/room201/all",
  "payload": {
    "action": "off"
  }
}

API Integration

The node can integrate with external platforms through the device host configuration. Ensure your platform provides the following endpoint:

GET /esaydevice/init?mac={mac_address}&layer={node_id}

This endpoint should return device configuration data including floors, areas, and device definitions.

Troubleshooting

Common Issues

  1. Device Not Responding

    • Check device host configuration
    • Verify network connectivity
    • Ensure correct MAC address
  2. Discovery Not Working

    • Verify topic format: /iot/discover
    • Check payload structure
    • Ensure platform integration is configured
  3. Action Commands Failing

    • Verify topic pattern: /iot/action/{parameters}
    • Check device configuration
    • Ensure device supports the requested action

Debug Mode

Enable Node-RED debug mode to see detailed message flows:

  1. Add debug nodes to monitor input/output
  2. Check Node-RED logs for error messages
  3. Verify device status indicators

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

ISC License - see LICENSE file for details

Support

For support and questions:

  • Create an issue on the GitHub repository
  • Check the Node-RED community forum
  • Review the Node-RED documentation

Changelog

Version 1.0.1

  • Initial release
  • Basic device management functionality
  • Multi-protocol support
  • Spatial organization features

Note: This node requires platform integration for full functionality. Ensure your IoT platform supports the expected API endpoints and message formats.

Node Info

Version: 1.0.2
Updated 3 days ago
License: ISC
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Nodes

  • easy-device
  • devicehost

Keywords

  • node-red
  • iot
  • device
  • management
  • modbus
  • sensor
  • lighting
  • automation
  • smart-home
  • industrial
  • zigbee
  • tcp
  • udp
  • rs485

Maintainers