Error Handling
P1 Meter
Supported
Energy Socket
Supported
Energy Display
Not supported
kWh Meter
Supported
Watermeter
Supported
Plug-In Battery
Not supported
See Supported Devices for more information.
When you perform an invalid request or something went wrong, the API will respond with an error message. You have to check if the HTTP status code returns 200 OK
before parsing the result.
If you use an endpoint that returns JSON, you also will receive an object with some error information.
Error Codes
The predefined error codes are as follows:
Code | Description |
---|---|
2 | BODY_CONTAINS_INVALID_JSON |
7 | INVALID_VALUE_FOR_PARAMETER |
8 | PARAMETER_IS_NOT_MODIFIABLE |
201 | REQUEST_TOO_LARGE |
202 | API_DISABLED |
901 | INTERNAL_ERROR |
Examples
API was Disabled
Request
curl http://<IP ADDRESS>/api/v1/data
Response
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": {
"id": 202,
"description": "API not enabled"
}
}
Invalid JSON
Request
curl http://<IP ADDRESS>/api/v1/state HTTP/1.1 \
-X PUT \
-H "Content-Type: application/json" \
-d '{"power_on": invalid_value}'
Response
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": {
"id": 2,
"description": "Body contains invalid json"
}
}
Invalid Value
Request
curl http://<IP ADDRESS>/api/v1/state HTTP/1.1 \
-X PUT \
-H "Content-Type: application/json" \
-d '{"brightness": 500}'
Response
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": {
"id": 7,
"description": "brightness value limited to 0-255"
}
}
Turn off Socket when Switch-lock is Enabled
Request
curl http://<IP ADDRESS>/api/v1/state HTTP/1.1 \
-X PUT \
-H "Content-Type: application/json" \
-d '{"power_on": false}'
Response
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": {
"id": 8,
"description": "power_on cannot be turned off when switch_lock is on"
}
}