Control Zone Switch
Control switches in a zone by setting their power state.
Description
The zone switch control allows you to manage multiple switches in a zone by setting:
- Power state (on/off)
Example
Request Topic
LYT/41e0d6b2-37de-43d8-a348-4ba94853b6cd/ZONE/CONTROL
Request Payload
Turn on all switches in zone:
{
"version": "v1.0",
"type": "switch",
"address": 50646,
"power": true
}
Field Descriptions
| Field | Type | Range | Description |
|---|---|---|---|
| version | string | "v1.0" | API version identifier |
| type | string | "switch" | Message type for switch control |
| address | number | zone address | Address of the target zone |
| power | boolean | true/false | Power state to set |
Response Topic
LYT/41e0d6b2-37de-43d8-a348-4ba94853b6cd/ZONE/E/STATUS
Response Payload
Success Response
{
"version": "v1.0",
"message": "success",
"type": "switch",
"address": 50646,
"switch": {
"power": true
}
}
Error Handling
The API may return various error responses based on different scenarios:
1. Constraint Error (Code: 3005)
a. Power Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "power must be a boolean value",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "switch",
"address": 50646
}
b. Version Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "version must be equal to v1.0",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "switch",
"address": 50646
}
c. 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": "switch",
"address": 50646
}
d. Address Constraint:
{
"message": "error",
"message_type": {
"code": 3005,
"message": "address must be a number conforming to the specified constraints",
"errorCode": "CONSTRAINT_ERROR"
},
"type": "switch",
"address": 50646
}
Constraint errors occur in the following cases:
-
Power Constraints:
- Power value must be true or false
- Power field is missing
- Power field has incorrect type (must be boolean)
-
Version Constraints:
- Version is not exactly "v1.0"
- Version field is missing
- Version field has incorrect format
-
Type Constraints:
- Type must be "switch"
- 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
Resolution:
- Ensure power is a boolean value (true/false)
- Always use "v1.0" as the version value
- Use "switch" as the type value
- Ensure address is a valid number
- Validate all parameters before sending
2. Zone Not Found Error (Code: 2005)
{
"message": "error",
"message_type": {
"code": 2013,
"message": "Zone not found",
"errorCode": "ZONE_NOT_FOUND"
}
}
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 |