-
-
Notifications
You must be signed in to change notification settings - Fork 38
API Documentation
This section provides detailed information about the PetLibro API used in this integration. The API allows you to interact with PetLibro devices, retrieve device status, and manage device settings programmatically.
The base URL for the API is:
https://api.us.petlibro.com
Retrieve a list of all devices associated with your PetLibro account.
Request:
-
Method:
GET -
URL:
/device/device/list -
Headers:
-
Authorization:Bearer {your_token}
-
Response:
{
"code": 200,
"data": [
{
"deviceId": "123456789",
"deviceName": "Granary Smart Feeder",
"deviceType": "Feeder",
"status": "online"
}
]
}Retrieve basic information for a specific device.
Request:
-
Method:
POST -
URL:
/device/device/baseInfo -
Headers:
-
Authorization:Bearer {your_token}
-
- Body:
{
"deviceId": "123456789"
}{
"code": 200,
"data": {
"deviceId": "123456789",
"deviceName": "Granary Smart Feeder",
"firmwareVersion": "1.0.0",
"batteryStatus": "Good"
}
}Retrieve real-time information from a specific device, such as feeding activity, current settings, and status.
Request:
-
Method:
POST -
URL:
/device/device/realInfo -
Headers:
-
Authorization:Bearer {your_token}
-
- Body:
{
"deviceId": "123456789"
}{
"code": 200,
"data": {
"deviceId": "123456789",
"feedingStatus": "Feeding",
"currentGrainLevel": "75%",
"nextScheduledFeed": "2024-10-20T08:00:00Z"
}
}Retrieve the current grain status of a feeder, such as the remaining food level and whether there are any blockages.
Request:
-
Method:
GET -
URL:
/device/data/grainStatus -
Headers:
-
Authorization:Bearer {your_token}
-
Response:
{
"code": 200,
"data": {
"deviceId": "123456789",
"remainingGrain": "75%",
"grainBlocked": false
}
}All API requests require an Authorization header with a Bearer token. You can obtain this token by logging in through the official PetLibro app or via the Home Assistant integration, which handles token generation automatically.
The following error codes are used in the PetLibro API integration:
- 200: Success - The request was successful.
- 1009: General Error - Indicates a failure or error in the API request.
- 401: Unauthorized - Invalid or expired token, requiring a new login or token refresh.
These codes are essential for troubleshooting issues when interacting with the PetLibro API.
For more detailed usage examples and device-specific features, please refer to the device's specific API documentation.
If you enjoy this integration and want to support its development, please consider backing the co-developers. On the discussions board, you’ll find their support links along with direct links to their GitHub profiles.