GitHub

Contributing

Thank you for helping. A report of how a conversion went is as useful as code: what worked, what did not, and on which plug and computer.

Reporting

Setting up

The tool needs nothing but Python 3.10 or newer. Working on it needs a few tools more - the test helpers and the linters - which go in a virtual environment in the checkout, never into the system’s Python:

tools/repo/setup-dev                       # creates .venv, installs both files below
python3 tools/repo/leak_scan.py install

tools/repo/setup-dev is the one-command form of:

python3 -m venv .venv
.venv/bin/python -m pip install --require-hashes --no-deps -r requirements/ci.txt -r requirements/lint.txt

uv works as well and faster, from the same files: uv venv and uv pip install --require-hashes -r ....

The leak-scan line points Git at the hooks in .githooks/: before each commit they scan what is staged for secrets and real identifiers, and lint it; before each push they scan every commit it sends. A linked worktree reuses this checkout’s .venv, so run tools/repo/setup-dev once in the main checkout - and in the worktree as well when its branch changes requirements/, or it lints with the main checkout’s versions.

Optional, for what they check: Docker, for the ESPHome configs’ check and the emulator; PowerShell 7.4.6 or newer (pwsh), with Install-Module PSScriptAnalyzer, for the PowerShell scripts. A commit on a computer without them is not stopped - the hook says what it skipped, and the workflows run them all.

Testing

python3 tests/run.py          # the unit tests, about 11 s
python3 tools/repo/lint.py all     # every linter on every file

Every fix comes with a test that fails without it. The tests run side by side and in any order, so a new test must leave nothing behind, keep hold of any port it picked, and touch nothing shared across the whole computer: docs/testing.md. Coverage and mutation testing show where the tests are thin - a guide, not a target: docs/testing.md. The emulator - a virtual S60 running the plug’s own firmware - tests whole conversions: docs/emulator.md. Never try a change on a plug you cannot afford to lose.

Keeping private things out

The repository is public, and the tool handles people’s Wi-Fi passwords, eWeLink accounts and plugs’ identities.

Commits and pull requests

Code

Writing docs

Write for the person reading the page, not from the side of whoever built the tool. That person may not know how the project works, or why it was made this way.

For example:

Instead of Write
so one you add changes nothing of ours The project’s config does not use substitutions, so you cannot change its settings with them
The tool then leaves the plug to the builder From then on you update the plug from the builder
Your config then fetches nothing from here The builder then downloads nothing from this project
ESPHome takes it for a new item and refuses it ESPHome treats it as a new item and shows an error

Released sections of CHANGELOG.md are history and stay as they were. tests/repo/test_docs_voice.py fails on “we”, “our”, “ours”, “us” and “from here” in the docs. docs/home-assistant-adoption.md is a good page to copy the style from.

Elsewhere

A bug found in another project - Tasmota, ESPHome, ESP-IDF, OpenBeken, the emulator’s QEMU - is reported there, and every pull request or issue opened because of work on this project gets an entry in docs/upstream-contributions.md in the same change, in that document’s style: a row in the table of the topic it belongs to (or a new topic, with a short introduction), giving the project, a link and one line on what it fixes, and a note on how the fix was proven. Open the pull request, then write the entry, so the link is real.

AI assistants working here: AGENTS.md.