package management is using uv
If it is not already installed, it can be installed using:
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
Use uv run ... to run commands on the project
uv run ruff check, uv run ruff check --select -Iuv run ruff formatuv run yamllintoptional: true in the config so that they are not required for matching.tinytuya scan.custom_components/tuya_local/devices/device_config_schema.json and documented in custom_components/tuya_local/devices/README.md.custom_components/tuya_local/devices folder for a device with the same set of functions. uv run best_match '${LOCAL_LOG}' can be helpful for finding the closest match.${BRAND}_${MODEL}_${TYPE}.yaml is used, where ${BRAND} is the brand as ASCII lower case letters and numbers with spaces and punctuation removed, ${MODEL} is the model name or number as ASCII lower case letters and numbers with spaces and punctuation removed, and ${TYPE} is the type of device as lower case ASCII letters with spaces and punctuation removed. If model is unknown, then ${BRAND}_${TYPE} can be used.optional: true in case the older variant is missing these.name inside the config should be generic, without branding, as other brands of device can often match the same config. Branding should go under products only.products entry for the device must have an id, as determined in the information gathering above. If known, the manufacturer and model should be filled in. Rarely, model is split into a descriptive model and a code model_id.category: config. Sensors and binary_sensors that are not generally useful in dashboards should have category: diagnostic.lock entities with translation_key: child_lock.binary_sensor entities with class: problem. When they are bitfields (bitmap in Tuya API), 0 should map to false, and the default mapping is to true. The raw value is available as a fault_code attribute on the entity, and if sufficient information is available for human readable descriptions of each fault, then a description attribute may be added with mapping of 0 to ok and other values to the appropriate human readable description.where a suitable class is available for a sensor, and it is the only sensor of that class, no name is necessary. Some classes of sensor have translation keys defined for ${CLASS}_x, these can be used when there are multiple sensors of the same class as:
- entity: sensor
class: ${CLASS}
translation_key: ${CLASS}_x
translation_placeholders:
x: "${N}"
where ${N} is a number, letter or word uniquely identifying that sensor among the class.
Where no such translation_key exists, a unique name is required instead.
Where one sensor stands out as the main sensor for that class, it can be unnamed and without translation_key, and all the others named or translated as above.
after creating the new device config, run uv run duplicates ${CONFIG_FILENAME}. If any 100% matches are listed, then explain the differences between the configs for the PR message.
uv run pytest to run every test defined for the projectuv run pytest tests/test_device_config.py to test only yaml file changes or additionsuv run pytest tests/test_translations.py to test only json file changes or additionsuv run ruff check ., uv run ruff check --select -I ., uv run ruff format --check . and uv run yamllint custom_components/tuya_local/devices before committing