feat: add versioned Smart Life and Tuya Smart profiles - #5
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📜 Recent review details🧰 Additional context used🪛 Betterleaks (1.7.3)tuya_mobile/profiles.py[high] 26-26: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key) [high] 30-30: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key) [high] 46-46: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key) [high] 50-50: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key) 🪛 Ruff (0.16.1)tuya_mobile/profiles.py[warning] 28-28: Implicitly concatenated string literals on one line Combine string literals (ISC001) [warning] 48-48: Implicitly concatenated string literals on one line Combine string literals (ISC001) [warning] 78-80: Avoid specifying long messages outside the exception class (TRY003) 🔇 Additional comments (6)
📝 SummarySummary by CodeRabbit
WalkthroughThe package now bundles versioned Smart Life and Tuya Smart profiles. It exposes profile selection and lookup APIs. ChangesApplication profiles
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR adds explicit versioned profiles and preserves existing custom-application support; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Caller
participant TuyaPasswordClient
participant get_mobile_app_profile
Caller->>TuyaPasswordClient: for_application(application, session, settings)
TuyaPasswordClient->>get_mobile_app_profile: resolve application
get_mobile_app_profile-->>TuyaPasswordClient: TuyaMobileAppProfile
TuyaPasswordClient-->>Caller: configured TuyaPasswordClient
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bundle versioned Smart Life and Tuya Smart identities so standalone callers can use password login without reconstructing application profiles. Keep selection explicit and preserve the custom-profile constructor for other Tuya-based applications. Refs ha-tuya-ble/ha_tuya_ble#163
5e683a2 to
e369961
Compare
|
Independent live validation is now available: jsimonetti reports that this PR successfully retrieved the |
|
Follow-up to the live-validation note above: jsimonetti confirmed that the successful credential retrieval used |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
Hi @AboveColin, could you please let me know whether you would like any further changes before this can be merged? CI and the full CodeRabbit review are green. The |
|
Thanks for the ping, and for the live validation notes. I reviewed the diff against
Nothing else blocking. Two smaller notes you can take or leave: |
Identify stale bundled Smart Life and Tuya Smart profiles in typed authentication errors so downstream users can distinguish app rotation from account failures. Document the public origin of the application constants and keep client defaults owned by TuyaPasswordClient.
|
Thanks for the clear review. I addressed all four points in
The full local suite passes with 35 tests, package import and build succeed, and CI is green on Python 3.9 through 3.13. |
Bundles immutable, versioned Smart Life and Tuya Smart profiles, adds `TuyaMobileApp`, `get_mobile_app_profile()` and `TuyaPasswordClient.for_application()`. Existing callers passing their own `TuyaMobileAppProfile` are unaffected: the diff adds code paths and exports without changing any existing one. A rejection of a bundled profile now raises `TuyaMobileProfileExpired` naming the profile and version, so a rotated app build reports its cause instead of a bare auth failure. Custom profiles keep the generic redacted error. The bundled constants come from public Android builds and are already published in several open-source projects, so the package is not a user credential store. Suite goes 24 to 35 passing. CI green on Python 3.9 through 3.13. Claude-Session: https://claude.ai/code/session_01CWPsjG4meqxYHSxBXiUjyd
Summary
TuyaMobileAppandget_mobile_app_profile()for explicit profile selection;TuyaPasswordClient.for_application()while preserving the existing constructor for custom Tuya-based applications.Context
Password login and device credential retrieval are now implemented in this package, but standalone callers still have to source the mobile application's signing identity themselves. That gap surfaced in ha-tuya-ble#163: the device data was available, while the caller was blocked on the application constants.
Keeping these two profiles here gives standalone callers and downstream integrations one maintained source. The values match the versioned profiles currently used by the pending Home Assistant integration.
Behavior and compatibility
TuyaMobileAppProfiledirectly.Validation
pytest: 30 passed;git diff --check;tuya_mobile/profiles.py.The repository CI passed across Python 3.9 through 3.13. Both profiles are covered by offline resolution, immutability, redaction, and client-construction tests. jsimonetti independently used this PR to retrieve a device
secKey; the exact Smart Life/Tuya Smart selector is being confirmed because the storefront names are ambiguous.