Skip to content
Jamie Jones edited this page Nov 8, 2024 · 3 revisions

PetLibro Home Assistant Integration

petlibro

Welcome to the PetLibro Home Assistant Integration! This repository provides support for PetLibro devices within Home Assistant, enabling control and monitoring directly from your smart home setup.

Overview

This integration communicates with PetLibro's API to manage and monitor your devices such as automatic feeders and smart fountains. With this integration, you can track feeding schedules, monitor device status, and even control settings remotely.

Key Features

  • Real-time Monitoring: View real-time status of your PetLibro devices.
  • Automated Feeding: Manage and automate feeding schedules via Home Assistant.
  • Customizable Settings: Adjust device settings like light, sound, and feeding plans.

Supported Devices

The current integration supports the following devices:

  • PetLibro Granary Smart Feeder (PLAF103)
  • PetLibro Granary Smart Camera Feeder (PLAF203)
  • PetLibro One RFID Smart Feeder (PLAF301)
  • PetLibro Polar Wet Food Feeder (PLAF109)
  • PetLibro Dockstream Smart Fountain (PLWF105)
  • PetLibro Dockstream RFID Smart Fountain (PLWF305)

We are continually working to expand support for more devices, and community contributions are always welcome.

API Information

The integration utilizes the official PetLibro API, which is responsible for:

  • Device Authentication
  • Data retrieval (e.g., feeding quantities, device status)
  • Device control (e.g., enabling/disabling feeding plans, adjusting settings)

The API is interacted with asynchronously, ensuring non-blocking behavior in Home Assistant. We utilize the following API calls:

  • POST requests for device commands (e.g., feeding, scheduling)
  • GET requests for device status and real-time data updates

Example API Call

Below is a basic example of how the API is accessed in the integration:

async def make_api_call(session, url, data):
    async with session.post(url, json=data) as response:
        if response.status != 200:
            raise PetLibroAPIError(f"Error: {response.status}")
        return await response.json()

The API uses token-based authentication, and the token is refreshed automatically during each session. You can configure the API in config_flow.py by providing your PetLibro email and password.

Contributing

If you wish to contribute to this repository, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Submit a pull request.

We welcome contributions for:

  • Adding support for new PetLibro devices
  • Enhancing the API integration
  • Improving documentation and features

Installation

For detailed installation instructions, please refer to the README file in the repository.

Troubleshooting

If you encounter any issues with the integration, please check the logs in Home Assistant for detailed error messages. Common issues include:

  • API token expiration (can be resolved by restarting the integration)
  • Unsupported devices (we are working on adding more devices)

Feel free to open an issue on GitHub if you need further assistance!