Control Zone RGB Light
Control RGB lights in a zone by adjusting their colors.
Description
The zone RGB control allows you to manage multiple RGB LED lights in a zone by setting:
- Red component (0-255)
- Green component (0-255)
- Blue component (0-255)
Example
Request Topic
LYT/41e0d6b2-37de-43d8-a348-4ba94853b6cd/ZONE/CONTROL
Request Payload
Set RGB values:
{
"version": "v1.0",
"type": "rgb",
"address": 50646,
"r": 255,
"g": 127,
"b": 0
}
Field Descriptions
| Field | Type | Range | Description |
|---|---|---|---|
| version | string | "v1.0" | API version identifier |
| type | string | "rgb" | Message type for RGB control |
| address | number | zone address | Address of the target zone |
| r | number | 0-255 | Red component intensity |
| g | number | 0-255 | Green component intensity |
| b | number | 0-255 | Blue component intensity |
Response Topic
LYT/41e0d6b2-37de-43d8-a348-4ba94853b6cd/ZONE/E/STATUS
Response Payload
Success Response
{
"version": "v1.0",
"message": "success",
"type": "rgb",
"address": 50646,
"rgb": {
"r": 255,
"g": 127,
"b": 0
}
}
Error Handling
The API may return various error responses based on different scenarios:
1. Constraint Error (Code: 3005)
a. Red Component Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "r must be between 0 and 255",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "rgb",
"address": 50646
}
b. Green Component Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "g must be between 0 and 255",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "rgb",
"address": 50646
}
c. Blue Component Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "b must be between 0 and 255",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "rgb",
"address": 50646
}
d. Version Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "version must be equal to v1.0",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "rgb",
"address": 50646
}
e. Type Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "type must be one of the following values: cct, dimmer, switch, fan, curtain, rgb",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "rgb",
"address": 50646
}
f. Address Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "address must be a number conforming to the specified constraints",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "rgb",
"address": 50646
}
Constraint errors occur in the following cases:
-
R Component Constraints:
- r value exceeds 255
- r field is missing when required
- r value is less than 0
-
G Component Constraints:
- g value exceeds 255
- g field is missing when required
- g value is less than 0
-
B Component Constraints:
- b value exceeds 255
- b field is missing when required
- b value is less than 0
-
Version Constraints:
- Version is not exactly "v1.0"
- Version field is missing
- Version field has incorrect format
-
Type Constraints:
- Type must be one of: "cct", "dimmer", "switch", "fan", "curtain", "rgb"
- Type field is missing
- Type field has incorrect value
-
Zone address Constraints:
- Zone address must be a number
- Zone address field is missing
- Zone address field has incorrect type (must be number)
Resolution:
- Ensure r is between 0-255
- Ensure g is between 0-255
- Ensure b is between 0-255
- Always use "v1.0" as the version value
- Use correct type value from allowed list: "cct", "dimmer", "switch", "fan", "curtain", "rgb"
- Ensure address is a number
- Validate all parameters before sending
2. Zone Not Found Error (Code: 2005)
{
"message": "error",
"message_type": {
"code": 2005,
"message": "Zone not found",
"errorCode": "ZONE_NOT_FOUND"
},
"type": "rgb",
"address": 50646
}
When it occurs:
- The specified address doesn't exist
- Zone has been deleted
- Zone is not configured
How to resolve:
- Verify the address is correct
- Check if the zone exists in the system
- Ensure the zone is properly configured
- Use zone management API to list available zones
Error Code Summary
| Code | Error Code | Description | Solution |
|---|---|---|---|
| 3005 | CONSTRAINT_ERROR | Parameter validation failed | Check input values |
| 2005 | ZONE_NOT_FOUND | Zone not available | Verify zone exists |
| 2002 | PROJECT_NOT_FOUND | Project doesn't exist | Check project_uuid |
| 3002 | REQUEST_TIMEOUT | Request took too long | Check connectivity |