Skip to main content

Error Handling

P1 Meter
Supported
Energy Socket
Supported in v1
Energy Display
In development
kWh Meter
Supported in v1
Watermeter
Supported in v1
Plug-In Battery
In development

See Supported Devices for more information.
warning

The HomeWizard Energy API v2 and its documentation are in beta and subject to change.

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 or 204 No Content if you expect no content (actions and set requests). If you use an endpoint that returns JSON, you also will receive an object with some error information.

Error Codes

Each error is represented as a set of 'scope' and 'error' fields. The 'scope' field indicates the part of the request that caused the error, and the 'error' field provides a description of the error. For example user:name-invalid if you provide an invalid name for the user during the authorization flow.

List of Errors

CodeDescription
request:invalid-jsonServer was unable to parse the JSON data.
json:no-parameters-recognizedJSON was correct, but no required parameters were found.
json:parameter-invalid-type:<parameter>Invalid type for a parameter, e.g. a string where a number is expected.
json:parameter-missing:<parameter>Required parameter is missing.
json:parameter-not-exclusiveTwo or more parameters are mutually exclusive.
request:api-version-not-supportedRequested API version not supported, see versioning.
request:internal-server-errorSomething went wrong on the server side.
request:too-largeRequest too large.
request:unknown-subscriptionWebSocket subscription topic not recognized, see WebSocket subscriptions.
request:unknown-typeWebSocket type parameter not recognized, see WebSocket structure.
telegram:no-telegram-receivedNo telegram received, see telegram.
user:creation-not-enabledUser creation is not enabled, button press required.
user:invalid-prefixInvalid name prefix provided, see create user.
user:name-emptyUpon creating a user, the name was empty.
user:name-invalidUpon creating a user, the name contained invalid tokens, see create user.
user:name-too-longUpon creating a user, the name was too long.
user:no-storageNo storage available to store a new user, delete existing users.
user:not-foundTried to delete a user which does not exist.
user:unauthorizedUser token is invalid or not authorized, see authorization.
tip

The list of error codes may be extended in the future. We recommend that you prepare for new error codes by having a generic error handling mechanism in place.

Examples

Not Authenticated

Request
curl https://<IP ADDRESS>/api --insecure \
-H "Authorization: Bearer <INVALID_TOKEN>" \
-H "X-Api-Version: 2" \
Response
https/1.1 401 Unauthorized
Content-Type: application/json

{
"error": "user:unauthorized"
}

Invalid Value

Request
curl https://<IP ADDRESS>/api/system --insecure \
-X PUT \
-H "Authorization: Bearer <TOKEN>" \
-H "X-Api-Version: 2" \
-d '{"status_led_brightness_pct": 123}'
Response
https/1.1 400 Bad Request
Content-Type: application/json

{
"error":"json:parameter-invalid-type:status_led_brightness_pct"
}