Skip to content

Commit b5f4735

Browse files
committed
Refactor SPH TL3 to follow consistent export pattern
Changed SPH TL3 profile to use the same export pattern as all other profile files (MIN, MID, SPH, MOD, etc.): - Added SPH_TL3_REGISTER_MAPS dictionary export in sph_tl3.py - Use **SPH_TL3_REGISTER_MAPS spread in __init__.py - Removed inconsistent direct profile import approach This matches the established pattern: - min.py exports MIN_REGISTER_MAPS - mid.py exports MID_REGISTER_MAPS - sph.py exports SPH_REGISTER_MAPS - sph_tl3.py now exports SPH_TL3_REGISTER_MAPS (consistent!) Benefits: - Consistent with all other profile files - Easier to add multiple profiles per file - Cleaner dictionary spread pattern 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3bd8e15 commit b5f4735

2 files changed

Lines changed: 5 additions & 27 deletions

File tree

custom_components/growatt_modbus/profiles/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .min import MIN_REGISTER_MAPS
2323
from .mid import MID_REGISTER_MAPS
2424
from .sph import SPH_REGISTER_MAPS
25-
from .sph_tl3 import SPH_TL3_3000_10000
25+
from .sph_tl3 import SPH_TL3_REGISTER_MAPS
2626

2727
# TODO: Create these files following the same pattern as min.py
2828
# from .mod import MOD_REGISTER_MAPS
@@ -38,8 +38,7 @@
3838
**MIN_REGISTER_MAPS,
3939
**MID_REGISTER_MAPS,
4040
**SPH_REGISTER_MAPS,
41-
# SPH TL3 profile (three-phase hybrid)
42-
'SPH_TL3_3000_10000': SPH_TL3_3000_10000,
41+
**SPH_TL3_REGISTER_MAPS,
4342
# Add others as they're created:
4443
# **MOD_REGISTER_MAPS,
4544
# **TL_XH_REGISTER_MAPS,

custom_components/growatt_modbus/profiles/sph_tl3.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,28 +118,7 @@
118118
}
119119
}
120120

121-
# Device profile entry for device_profiles.py
122-
DEVICE_PROFILE_SPH_TL3 = {
123-
"sph_tl3_3000_10000": {
124-
"name": "SPH-TL3 3000-10000",
125-
"description": "Three-phase hybrid inverter with battery storage (3-10kW)",
126-
"register_map": "SPH_TL3_3000_10000",
127-
"phases": 3,
128-
"has_pv3": False, # SPH-TL3 typically has 2 PV inputs
129-
"has_battery": True,
130-
"max_power_kw": 10.0,
131-
"sensors": (
132-
"BASIC_PV_SENSORS |"
133-
"BASIC_AC_SENSORS |"
134-
"THREE_PHASE_SENSORS |"
135-
"GRID_SENSORS |"
136-
"POWER_FLOW_SENSORS |"
137-
"CONSUMPTION_SENSORS |"
138-
"ENERGY_SENSORS |"
139-
"ENERGY_BREAKDOWN_SENSORS |"
140-
"BATTERY_SENSORS |"
141-
"TEMPERATURE_SENSORS |"
142-
"STATUS_SENSORS"
143-
),
144-
}
121+
# Export all SPH TL3 profiles
122+
SPH_TL3_REGISTER_MAPS = {
123+
'SPH_TL3_3000_10000': SPH_TL3_3000_10000,
145124
}

0 commit comments

Comments
 (0)