Prepare a Tuya test fixture locally
Turn a synthetic Home Assistant diagnostics example into a local candidate for review before adding it to integration tests. Keep your existing Tuya Device Handlers checks. This is not an official Home Assistant or Tuya tool.
Try the synthetic example
Verify the checksum, extract the ZIP into a new directory and inspect its contents. Use Python 3.12 in a disposable virtual environment. Installation needs package access; conversion runs locally.
Linux / macOS
python3.12 -m venv .venv
.venv/bin/python -m pip install --require-hashes --only-binary=:all: --no-deps -r requirements.txt
mkdir tuya-review
.venv/bin/python prepare_tuya.py diagnostic.json --output-dir tuya-review
Windows PowerShell
py -3.12 -m venv .venv
.\.venv\Scripts\python.exe -m pip install --require-hashes --only-binary=:all: --no-deps -r requirements.txt
mkdir tuya-review
.\.venv\Scripts\python.exe prepare_tuya.py diagnostic.json --output-dir tuya-review
Expected: a new cz_DemoPlug01.json and a candidate-written message. Repeat to see overwrite rejection (exit 2). Try diagnostic-rejected.json in a new empty review directory: exit 1, no output.
What the helper adds
Extracts the data object, removes three excluded root keys, normalizes device_info, validates the filename and checks the four required media/alarm masks. It rejects a failed check rather than silently rewriting media values. Unknown sensitive fields can remain.
See the upstream contributor instructions at the reviewed revision. Keep the actual upstream tests and manual review.
Evidence and limitations
Windows, Linux and macOS tests passed. A first-party synthetic candidate loaded through the pinned upstream loader. In 30 paired local timing trials, clean outputs matched; the helper added about 13 ms to the median machine runtime. No human maintenance savings or independent adoption is established.
Synthetic inputs only for this trial. Do not upload raw diagnostics, credentials or identifiers. A clean result is not a privacy guarantee.
Would this help your test workflow?
Voluntary evaluation: compare with your current workflow or a small local script. Negative feedback is useful. Report non-sensitive feedback or report a suspected vulnerability privately.