-
Notifications
You must be signed in to change notification settings - Fork 22
How to contribute
user2684 edited this page Jan 27, 2024
·
11 revisions
You are more than welcome to contribute to this project!
Github is used to host code, to track issues and feature requests, as well as accept pull requests. Pull requests are the best way to propose changes to the codebase.
The integration follows Home Assistant best practice. As a matter of fact there are two components:
- imouapi: which provides classes for both low level API interaction as well as device and sensors abstractions. Full documentation here.
- imou_life: the Home Assistant integration itself which leverages imouapi for interacting with the devices.
As a rule of thumb, whatever requires interaction with the device or with the abstract classes (devices, sensors, etc.) goes into imouapi, whatever instead requires interaction with the Home Assistant framework, goes into imou_life.
In order to test the integration you may want to setup a Home Assistant Developer Environment by going through the following steps:
- Review in details the instructions at https://developers.home-assistant.io/docs/development_environment/ to install all the requirements and setup the environment. Specifically ensure to:
- Fork https://github.com/home-assistant/core
- Install run Docker Desktop
- Paste the URL of your forked repository in the link above to open it into VSCode devcontainer
- Run Home Assistant by clicking on "Run and Debug" in VSCode. The first time run "Home Assistant" tasks, the following tasks you may want to run "Home Assistant (skip pip)", especially if you are testing a manually installed imouapi version
- The first time is run, all the dependencies are download and you are asked to create a user. Create new user, for example: admin/admin
- Home Assistant interface can be accessed via http://localhost:8123
- Fork the repositories and clone them inside the devcontainer:
mkdir imou
git clone https://github.com/user2684/imouapi
git clone https://github.com/user2684/imou_life
- Install build/test dependencies:
pip install poetry tox bump2version pytest pytest_homeassistant_custom_component
- Optionally install the imouapi library if you need to test a new version of the library. Repeat this task every time you change something in the imouapi library
pip install -e imouapi
- Optionally test if the imouapi library works correctly:
python -m imouapi.cli --app-id <app_id>--app-secret <app_secret> discover
python -m imouapi.cli --app-id <app_id>--app-secret <app_secret> get_device <device_id>
- Install the integration in Home Assistant. A manual process could be the following. This will create a symlink to the previously cloned repository
mkdir <ha>/config/custom_components
ln -s /workspaces/homeassistant-core/imouapi/imou_life/custom_components/imou_life .
- Edit Home Assistant configuration.yml file to add debug logging
- Install ffmpeg if you need to test live video streaming:
sudo apt-get update; sudo apt-get install ffmpeg