-
Notifications
You must be signed in to change notification settings - Fork 144
Delta Pro 3対応とprotobuf修正 #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add VS Code task descriptions for Reset homeassistant, Generate Docs, and Run Home Assistant Core - Document dual API architecture (private/public) - Explain device registry structure with internal/public implementations - Detail MQTT client architecture and protocol buffer usage - Document entity types, configuration migration, and development workflow - List key dependencies and development utilities - Provide guidance for manual testing and documentation generation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…frastructure This squashed commit consolidates multiple improvements: **Device Support:** - Add complete Delta Pro 3 device implementation (642 lines) - Implement sensors, switches, and controls for Delta Pro 3 - Add protocol buffer definitions and generated code (1214 lines) - Update device registry with new device mappings **Development Infrastructure:** - Add comprehensive Makefile with development shortcuts - Implement reset, docs, run, dev, and clean targets - Add UTF-8 decode error handling for binary protobuf data - Improve MQTT message processing for binary data **Technical Improvements:** - Add support for binary protobuf data detection - Implement proper error handling for non-JSON messages - Update device parameter IDs and configurations - Add comprehensive device documentation generation Co-Authored-By: Claude <[email protected]>
- setMessageで重複していたsetHeaderを削除し、統一されたHeaderメッセージを使用 - Protocol Buffersの構造統一により、DeltaPro3のエンティティ情報取得機能を復旧 - 生成されたPythonファイルも対応する構造変更を反映 Fixes: DeltaPro3統合機能でエンティティ情報が取得できない問題
- Add cmdFunc254_cmdId22_Report message definition to ef_dp3_iobroker.proto - Add handling for cmdFunc=254, cmdId=22 in delta_pro_3.py - Add handling for cmdFunc=254, cmdId=23 in delta_pro_3.py - Add fallback handling when protobuf classes are not available
- Add pb2 import to _decode_header_message method - Add pb2 import to _decode_message_by_type method - Fix 'name pb2 is not defined' error in all methods that use pb2
- Add better error handling for pb2 module import - Add detailed error logging for HeaderMessage parsing - Improve debugging information for protobuf issues
- Change warning to debug level for missing protobuf classes - Add basic timestamp extraction from raw data - Improve error handling for cmdFunc=254, cmdId=22 and cmdId=23 messages
…e type - Change from cmdFunc254_cmdId22_Report to RuntimePropertyUpload - Update comments to reflect correct message purpose (ランタイムプロパティ) - Maintain fallback handling for when protobuf classes are not available - Based on documentation: cmdId=22, cmdFunc=254 is RuntimePropertyUpload for frequent runtime data
…tor in ef_dp3_iobroker_pb2.py - Added import for ef_dp3_iobroker_pb2 in _preload_proto.py - Updated DESCRIPTOR in ef_dp3_iobroker_pb2.py to include ecopacket.proto for improved message handling
Prevent development-specific files from being committed to main branch: - AI assistant configurations (.claude/, .cursor/) - Development documentation (docs_4ai/) - Research scripts (scripts/) - Development tools (.devcontainer/post-start.sh, Makefile, etc.) Main branch should only contain upstream sync + DeltaPro3 support code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Remove duplicate message definitions from ef_dp3_iobroker.proto (EventRecordItem, ProductName*, RTCTime* were already in platform.proto) - Fix import statement to use relative import in ef_dp3_iobroker_pb2.py (Changed `import ecopacket_pb2` to `from . import ecopacket_pb2`) - Add missing imports: smart_meter, stream_ac to registry.py (These were lost during upstream merge conflict resolution) - Fix duplicate delta_pro_3 import that was causing issues - Update manifest.json: protobuf>=4.23.0 → protobuf>=6.32.0 (Required for protobuf 6.x compiled proto files compatibility) - Merge conflict during upstream sync caused missing imports - Proto files compiled with protobuf 6.x required runtime upgrade - Duplicate definitions caused "duplicate symbol" errors Fixes integration startup and MQTT connection for Delta Pro 3 devices. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Change absolute imports to relative imports in ef_dp3_iobroker_pb2 files to resolve ModuleNotFoundError for ecopacket_pb2 module. Changes: - ef_dp3_iobroker_pb2.py: Use relative import for ecopacket_pb2 - ef_dp3_iobroker_pb2.pyi: Use relative import and consolidate typing imports - Add Japanese translation file (ja.json) - Add detailed fix documentation The protobuf files are auto-generated from .proto files, but the import style depends on the protoc version used. Relative imports are correct for same-directory modules in Python packages. Resolves: ModuleNotFoundError: No module named 'ecopacket_pb2' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add missing BMSHeartBeatReport protobuf message to support battery cycles and energy accumulation tracking in Delta Pro 3. Changes: - Add BMSHeartBeatReport message (82 fields) to ef_dp3_iobroker.proto - Recompile protobuf with compatible version 5.29.0 - Fix relative imports in generated protobuf files - Update sensor definitions to use BMSHeartBeatReport fields: - cycles: Battery cycle count - accu_chg_energy: Total charge energy (Wh) - accu_dsg_energy: Total discharge energy (Wh) - Fix protobuf version requirement: 6.32.0 -> 5.29.1 This resolves unknown/unavailable entity issues for: - Battery Cycles - Total Charge Energy - Total Discharge Energy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…gy metrics - Remove incorrect cmdFunc=32,cmdId=50 -> RuntimePropertyUpload mapping - Add cmdId=50 to BMSHeartBeatReport condition for proper decoding - Restore BaseDevice to upstream state (remove _is_binary_data) - Add development commands to Makefile (run, restart, stop, logs, status) - Add debug logging and fallback handling Fixes 3 unavailable entities: - Cycles (field 14) - Total Charge Energy (accu_chg_energy, field 79) - Total Discharge Energy (accu_dsg_energy, field 80) Reference: ioBroker confirms cmdFunc=32, cmdId=50 = BMSHeartBeatReport
- Change sensor field names from snake_case to camelCase - accuChgEnergy and accuDsgEnergy now match Protobuf MessageToDict output - Follows upstream pattern (stream_ac.py uses same convention) - Fixes Total Charge Energy and Total Discharge Energy entities - All 44 Delta Pro 3 entities now working (100% success rate) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
We should carefully check for compatibility issues with other devices after upgrading to protobuf 5.29.1. Some integrations have reported errors or compatibility problems, so thorough testing is recommended. protobuf 5.29.1にアップグレードした後、他のデバイスとの互換性問題を慎重に確認すべきです。一部のインテグレーションでエラーや互換性の問題が報告されているため、十分なテストを推奨します。 |
|
I have Delta Pro 3. How can I help? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the Delta Pro 3 device by implementing Protobuf message decoding, updating the device registry, and upgrading the protobuf dependency.
Key Changes:
- Added Delta Pro 3 device implementation with Protobuf support for MQTT message decoding
- Updated protobuf dependency from >=4.23.0 to >=5.29.1
- Added Japanese translation file for the integration
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| custom_components/ecoflow_cloud/manifest.json | Updated protobuf version requirement |
| custom_components/ecoflow_cloud/devices/registry.py | Added Delta Pro 3 to device registry with alphabetized imports |
| custom_components/ecoflow_cloud/devices/internal/delta_pro_3.py | New device implementation with Protobuf decoding for Delta Pro 3 |
| custom_components/ecoflow_cloud/devices/internal/proto/ef_dp3_iobroker_pb2.py | Generated Python Protobuf bindings for Delta Pro 3 messages |
| custom_components/ecoflow_cloud/devices/internal/proto/ef_dp3_iobroker_pb2.pyi | Type stub file for Protobuf bindings |
| custom_components/ecoflow_cloud/devices/internal/proto/ef_dp3_iobroker.proto | Protobuf schema definition for Delta Pro 3 device messages |
| custom_components/ecoflow_cloud/_preload_proto.py | Added preload import for Delta Pro 3 Protobuf module |
| custom_components/ecoflow_cloud/translations/ja.json | Added Japanese translations for UI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
custom_components/ecoflow_cloud/devices/internal/delta_pro_3.py
Outdated
Show resolved
Hide resolved
|
|
||
| # Home Assistant反映用に必ず'params'キーで返す | ||
| _LOGGER.debug(f"[DeltaPro3] Successfully processed protobuf data, returning {len(flat_dict)} fields") | ||
| return { # noqa: TRY300 |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The # noqa: TRY300 comment suppresses the 'Consider moving this statement to else block' warning. However, this return statement should be moved outside the try block since it's the successful path and doesn't need exception handling. Remove the noqa comment and restructure the code properly.
| elif (cmd_func == 3 and cmd_id in [1, 2, 30, 50]) or \ | ||
| (cmd_func == 254 and cmd_id in [24, 25, 26, 27, 28, 29, 30]) or \ | ||
| (cmd_func == 32 and cmd_id in [1, 3, 50, 51, 52]): |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The complex multi-line condition with hardcoded command function/ID mappings should be extracted into a named constant or helper method for better maintainability. Consider creating a set of tuples like BMS_HEARTBEAT_COMMANDS = {(3, 1), (3, 2), ...} and checking (cmd_func, cmd_id) in BMS_HEARTBEAT_COMMANDS.
| try: | ||
| _LOGGER.debug(f"Processing {len(raw_data)} bytes of raw data") | ||
|
|
||
| # 1. HeaderMessageのデコード |
Copilot
AI
Oct 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is in Japanese. Should be translated to English: '# 1. Decode HeaderMessage' for consistency with the codebase.
| # 1. HeaderMessageのデコード | |
| # 1. Decode HeaderMessage |
Ref: tolwi#595 (review) (cherry picked from 516ceb6, 80a05d1)
…3 import fallback in delta_pro_3.py
- _preload_proto.pyでef_dp3_iobroker_pb2を事前読み込み - delta_pro_3.pyでモジュールトップレベルでインポート(powerstream.pyと同じパターンに統一) - dev_apl_commを_preload_proto.pyから削除(TIME_TASK_MODE重複シンボルエラー回避) - 空のimport文を削除してSyntaxErrorを修正 これにより、エンティティが正常にデータを取得できるようになった。
Development-specific .gitignore entries should only exist in dev branch, not in PR to upstream/main
Delta Pro 3デバイスの統合、バグ修正、エネルギーセンサー項目の修正を含む更新