Tuya - Add local protocol 3.5 support - PR2#2438
Tuya - Add local protocol 3.5 support - PR2#2438Terdious wants to merge 56 commits intoGladysAssistant:masterfrom
Conversation
…er models - Added support for air conditioning devices with new mappings and DPS configurations. - Introduced local polling for Tuya devices to improve responsiveness. - Enhanced device conversion logic to include additional parameters such as cloud IP and local override. - Updated feature conversion to utilize advanced DPS mappings for air conditioning. - Implemented new models for air conditioning and power meter, including specific feature mappings. - Improved error handling and logging for local polling and device value setting. - Added unit tests for new feature mappings and conversion logic.
…y device conversion logic
…ttre à jour les tests associés
… champ d'erreur dans le payload de l'événement WebSocket
…s et ajouter des tests pour la gestion des appareils locaux
…on Tuya dans les fichiers de langue
…ion Tuya et mettre à jour les traductions
… des appareils Tuya
…tre l'utilisation d'adresses spécifiques
…eurs de port et mise à jour des traductions
…re des liens vers la documentation et les options de connexion
…réation de rapports GitHub pour les appareils Tuya
…l disconnect features - Added new translations for connection status messages in German, English, and French. - Implemented API endpoints to get Tuya connection status and to manually disconnect from the Tuya cloud. - Updated the Tuya service to handle automatic reconnection logic and manual disconnect state. - Enhanced the SetupTab component to reflect connection status and provide a disconnect button. - Added tests for the new functionality, including status retrieval and manual disconnect.
- Implemented device ranking and sorting in DiscoverTab for better user experience. - Added loading indicators and improved UI feedback during device scanning. - Refactored local polling logic to update discovered devices with local information. - Introduced utility functions for managing device parameters, including upserting and normalizing values. - Enhanced local scan response handling to merge existing device parameters. - Updated tests to cover new functionality and ensure reliability of device management.
…ls et des tests associés
… débogage pour la gestion des appareils
…age, ajouter des tests pour la reconnexion automatique et la découverte des appareils
… des paramètres dans le code de configuration Tuya
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds local UDP scanning and multi-protocol local polling for Tuya, extends frontend cloud/local flows and connection lifecycle, exposes server endpoints (local-poll, local-scan, status, disconnect), implements auto-reconnect/manual-disconnect and device param utilities, updates tests, and adds i18n entries (de/en/fr). Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Web Client
participant Server as Gladys Server
participant WebSocket as WebSocket
participant TuyaCloud as Tuya Cloud API
participant LocalDevice as Local Tuya Device
Client->>Server: POST /api/v1/service/tuya/local-poll (device params)
activate Server
Server->>LocalDevice: Connect via TuyAPI / tuyapi-newgen (protocol attempts)
LocalDevice-->>Server: DPS response / error
Server->>Server: updateDiscoveredDeviceAfterLocalPoll -> persist params
Server->>WebSocket: Emit TUYA.STATUS / TUYA.ERROR
Server-->>Client: { dps, device? }
deactivate Server
Client->>Server: POST /api/v1/service/tuya/local-scan (timeout)
activate Server
Server->>LocalDevice: UDP scan on ports 6666/6667/7000
LocalDevice-->>Server: discovery packets
Server->>Server: buildLocalScanResponse (merge with discoveredDevices/state)
Server-->>Client: { devices, local_devices, port_errors }
deactivate Server
Client->>Server: GET /api/v1/service/tuya/status
activate Server
Server->>Server: getStatus (reads MANUAL_DISCONNECT, lastError, status)
Server-->>Client: { status, connected, configured, manual_disconnect, error }
deactivate Server
Client->>Server: POST /api/v1/service/tuya/disconnect
activate Server
Server->>Server: manualDisconnect -> set MANUAL_DISCONNECT = true -> disconnect({ manual: true })
Server->>WebSocket: Emit TUYA.STATUS (manual_disconnect: true)
Server-->>Client: { success: true }
deactivate Server
Note over Server: Background auto-reconnect loop (RECONNECT_INTERVAL_MS)
Server->>TuyaCloud: fetch config & attempt connect when not manual_disconnect
TuyaCloud-->>Server: connected / error
Server->>WebSocket: Emit TUYA.STATUS / TUYA.ERROR accordingly
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
#3945 Bundle Size — 11.46MiB (+0.62%).4a5ec79(current) vs 8db6b0d master#3902(baseline) Warning Bundle contains 2 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
Bundle analysis report Branch Terdious:tuya-local-protocol-3.5 Project dashboard Generated by RelativeCI Documentation Report issue |
e7959c6 to
74b081e
Compare
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Pull Request check-list
To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:
npm teston both front/server)npm run eslinton both front/server)npm run prettieron both front/server)npm run compare-translationson front)front/src/config/demo.js) so that the demo website is working without a backend? (if needed) See https://demo.gladysassistant.com.NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
Description of change
Summary
Details
@demirdeniz/tuyapi-newgenalongside the existing Tuya stack.Scope
Translate
Front
Server
Server Tests
Package
Summary by CodeRabbit
New Features
UI
Localization
Tests