Claude/review diagnostic py 011 c ur ju kd yc x fzhna g5vzib - #20
Merged
Conversation
fix incorrect mapping for 1000tl-x
fix manifest v0.0.3
Add diagnostic service
0.0.4 beta 1
v0.0.4b2 for testing
0.0.4-beta.3
update manifest
V0.0.5 - Add MIC profile. Fixes #16
v0.0.6 fix 3-phase sensors
Enhanced the diagnostic.py register scanning logic to provide complete visibility: Changes: - Modified _read_registers_chunked() to return status for ALL registers attempted, not just successful non-zero values - Now tracks three states: 'success', 'error' (Modbus errors), and 'exception' (Python exceptions) - Added detailed Modbus error code mapping (Illegal Data Address, etc.) - Updated CSV output to include ALL sequential registers in each range - Added "Status/Comment" column to CSV showing: * "Read OK" for successful reads with non-zero values * "Read OK (zero value)" for successful reads that returned 0 * "Modbus Error: [error type]" for Modbus protocol errors (e.g., illegal address) * Exception details for connection/timeout errors Benefits: - CSV now shows complete sequential register map with gaps clearly identified - Can distinguish between registers that returned 0 vs registers that don't exist - Modbus errors (like "Illegal Data Address") are logged so users know which registers are invalid - Better diagnostics for troubleshooting register mapping issues This addresses the issue where the CSV only showed registers with values, making it unclear if missing entries were due to zero values, Modbus errors, or invalid register addresses.
Enhanced the register dump CSV to include register name lookups from the register map: Changes: - Import register maps (INPUT_REGISTERS_BASE, INPUT_REGISTERS_STORAGE, HOLDING_REGISTERS) - Added _lookup_register_info() function to look up register definitions - New "Suggested Match" column in CSV showing register name, scale, unit, and description - Example output: "Grid_Voltage (×0.1, V) - Grid voltage (Phase 1 for single-phase)" Benefits: - Correlate raw register scan with known register definitions - Validate if register map matches actual inverter responses - More human-readable CSV showing what each register likely represents - Helps identify unknown registers by comparing with documented ones The suggested match is optional and gracefully falls back to empty string if: - Register map file is not available - Register is not defined in any map - This allows diagnostic to work even without register definitions Example CSV output: Register, Hex, Raw Value, ×0.1, Suggested Match, Status/Comment 38, 0x0026, 2345, 234.5, Grid_Voltage (×0.1, V), Read OK 39, 0x0027, 0, 0.0, Grid_Current (×0.1, A), Read OK (zero value) 40, 0x0028, , , Grid_Power_H (×0.1, VA), Modbus Error: Illegal Data Address
Enhanced the diagnostic scanner to intelligently detect inverter models even when scanning at night or during standby mode when PV voltage is zero. Key improvements: - Add fallback detection using 3-phase indicators (registers 42, 46) - Use battery indicators (register 1013 and storage range 1000-1124) - Detect SPH TL3 when 3-phase + battery + storage range found - Range-based detection for MIN/MOD series in standby - Provide clear reasoning about night/standby mode detection - Add confidence levels for fallback detections The scanner now works reliably during both day (PV generating) and night (standby mode) scans, using alternative register patterns to identify the inverter model.
PROBLEM:
User reported battery sensors (SOC, voltage, current, power) showing zero
even though register scan shows valid non-zero data. Register scan showed:
- Battery voltage: 73.26V (register 3169) ✓
- Battery current: 0.3A (register 3170) ✓
- Battery SOC: 14% (register 3171) ✓
- Battery temp: 36.8°C (register 3176) ✓
- Battery power registers 3178-3180: MISSING on this hardware ✗
ROOT CAUSES:
1. Naming mismatch: Code looks for 'charge_power_low' but MOD profile had
'battery_charge_power_low' → registers not found → zero values
2. Missing hardware: Registers 3178-3180 don't exist on some MOD inverters
3. Missing field: battery_current was in register map but not in dataclass
FIXES:
1. Renamed MOD battery power registers to match expected naming:
- battery_discharge_power_low → discharge_power_low
- battery_charge_power_low → charge_power_low
2. Added battery_current field to GrowattData dataclass
3. Enhanced _read_battery_data() to:
- Read battery_current from register 3170
- Fallback to calculate power from V×I when registers missing:
* charge_power = V × |I| when current < 0 (charging)
* discharge_power = V × I when current > 0 (discharging)
4. Updated battery_current sensor condition to show when battery_voltage > 0
5. Added documentation notes about missing registers on some MOD hardware
RESULT:
Battery sensors now display correct values from registers. When power
registers (3178-3181) are missing, power is calculated from voltage × current.
0xAHA
added a commit
that referenced
this pull request
Mar 22, 2026
…UKdYcXFzhnaG5vzib Claude/review diagnostic py 011 c ur ju kd yc x fzhna g5vzib
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.
SPH and MOD changes for testing