Skip to content
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

Growatt TL3-XH: Scale battery voltage depending on battery system #1099

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion custom_components/solax_modbus/plugin_growatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ def value_function_today_s_solar_energy(initval, descr, datadict):
def value_function_combined_battery_power(initval, descr, datadict):
return datadict.get('battery_charge_power', 0) - datadict.get('battery_discharge_power',0)

def value_function_battery_voltage(initval, descr, datadict):
bms = datadict.get('bms_monitoring_version', 0)
if bms == "ZECA": #Battery system APX HV (ZECA) uses 0.1 scaling factor for battery voltage
initval = initval / 10
else:
initval = initval / 100
return initval

def value_function_total_grid_power(initval, descr, datadict):
return datadict.get('grid_power_l1', 0) + datadict.get('grid_power_l2', 0) + datadict.get('grid_power_l3', 0)

Expand Down Expand Up @@ -4872,6 +4880,14 @@ def value_function_run_mode(initval, descr, datadict):
allowedtypes = GEN4,
entity_category = EntityCategory.DIAGNOSTIC,
),
GrowattModbusSensorEntityDescription(
key = "bms_monitoring_version",
register = 3096, #used for battery voltage scaling
unit = REGISTER_STR,
wordcount=2,
allowedtypes = GEN4 | HYBRID,
internal = True,
),
GrowattModbusSensorEntityDescription(
name = "Today's Battery Output Energy",
key = "today_s_battery_output_energy",
Expand Down Expand Up @@ -5109,7 +5125,7 @@ def value_function_run_mode(initval, descr, datadict):
device_class = SensorDeviceClass.VOLTAGE,
register = 3169,
register_type = REG_INPUT,
scale = 0.1, #doc says 0.01, but datasheet of APX HV system module for MOD / MID TL-XH (BP) inverters have operating voltage range 600-980V.
scale = value_function_battery_voltage, #due to different scaling factor depending on battery system, default scale 0.01
rounding = 2,
allowedtypes = GEN4 | HYBRID,
),
Expand Down
Loading