Add comprehensive SOC (State of Charge) extraction functionality#31
Open
alexlenk wants to merge 1 commit intoyoziru:mainfrom
Open
Add comprehensive SOC (State of Charge) extraction functionality#31alexlenk wants to merge 1 commit intoyoziru:mainfrom
alexlenk wants to merge 1 commit intoyoziru:mainfrom
Conversation
- Add SOCData struct for holding battery level, usable battery level, and charge limit - Implement extractSOCFromChargeState() for basic SOC field extraction - Implement populateSOCData() for comprehensive SOC data population - Implement parseChargeStateFromVehicleData() for extracting ChargeState from VehicleData - Implement extractSOCFromVehicleData() for end-to-end SOC extraction - Add comprehensive test coverage with 5 new SOC-focused tests This provides a complete API for Tesla vehicle State of Charge retrieval through the existing GetVehicleData message building infrastructure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive SOC (State of Charge) extraction functionality to the tesla-ble library, enabling accurate battery state monitoring from Tesla BLE protocol data.
🚀 Key Features
CarServer_VehicleDataandCarServer_ChargeStatebattery_level,usable_battery_level, andcharge_limit_soc🔧 Technical Implementation
SOCDatastructure for structured battery data accessextractSOCFromVehicleData()- End-to-end extraction (recommended)populateSOCData()- High-level SOC data populationextractSOCFromChargeState()- Direct ChargeState parsing📊 Battery Metrics Provided
✅ Verification
🔗 Integration Ready
This implementation is designed to integrate seamlessly with ESPHome and other Tesla BLE applications. A companion pull request will be submitted to the ESPHome Tesla BLE wrapper (yoziru/esphome-tesla-ble) to expose these SOC sensors in Home Assistant.
📋 Files Changed
include/client.h- SOC data structures and method declarationssrc/client.cpp- Complete SOC extraction implementationtests/test_message_parsing.cpp- Comprehensive SOC test suiteREADME.md- Updated documentation with SOC examples🎯 Use Case Examples
This enhancement significantly expands the tesla-ble library's capabilities for battery monitoring and smart charging applications.
🤖 Generated with Claude Code