Commit 7b73fc3
committed
Fix MOD series battery sensors showing zero values
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.1 parent 796ba80 commit 7b73fc3
3 files changed
Lines changed: 31 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
658 | 659 | | |
659 | 660 | | |
660 | 661 | | |
661 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
662 | 669 | | |
663 | 670 | | |
664 | 671 | | |
665 | 672 | | |
666 | 673 | | |
667 | | - | |
| 674 | + | |
668 | 675 | | |
669 | 676 | | |
670 | 677 | | |
671 | 678 | | |
672 | 679 | | |
673 | | - | |
674 | | - | |
| 680 | + | |
| 681 | + | |
675 | 682 | | |
676 | 683 | | |
677 | 684 | | |
678 | 685 | | |
679 | 686 | | |
680 | 687 | | |
681 | 688 | | |
682 | | - | |
683 | | - | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
684 | 695 | | |
685 | 696 | | |
686 | 697 | | |
687 | 698 | | |
688 | 699 | | |
689 | 700 | | |
690 | 701 | | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
691 | 706 | | |
692 | 707 | | |
693 | 708 | | |
| |||
726 | 741 | | |
727 | 742 | | |
728 | 743 | | |
729 | | - | |
| 744 | + | |
730 | 745 | | |
731 | 746 | | |
732 | 747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
453 | | - | |
| 453 | + | |
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
| |||
0 commit comments