node-red-contrib-easy-device 1.0.2
A Node-RED node for easy IoT device management with platform integration support
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
- Open Node-RED in your browser
- Go to the menu (≡) → Manage palette
- Click on the "Install" tab
- Search for
node-red-contrib-easy-device
- Click "Install"
Via npm
npm install node-red-contrib-easy-device
Manual Installation
- Navigate to your Node-RED user directory (typically
~/.node-red
) - Run the installation command:
npm install node-red-contrib-easy-device
- Restart Node-RED
Usage
Basic Setup
- Add the Easy Device Node: Drag the "easy-device" node from the device category to your flow
- Configure Device Host: Set up the device host configuration with IP and port
- Configure Spatial Information: Set space, floor area, and floor details
- 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:
Device Discovery:
{ "topic": "/iot/discover", "payload": timestamp }
Enhanced Discovery:
{ "topic": "/iot/yqdiscover", "payload": timestamp, "devices": [array_of_devices] }
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
- Port 1: Device discovery responses
- Port 2: Group control responses
- 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
Device Not Responding
- Check device host configuration
- Verify network connectivity
- Ensure correct MAC address
Discovery Not Working
- Verify topic format:
/iot/discover
- Check payload structure
- Ensure platform integration is configured
- Verify topic format:
Action Commands Failing
- Verify topic pattern:
/iot/action/{parameters}
- Check device configuration
- Ensure device supports the requested action
- Verify topic pattern:
Debug Mode
Enable Node-RED debug mode to see detailed message flows:
- Add debug nodes to monitor input/output
- Check Node-RED logs for error messages
- Verify device status indicators
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- 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.