Skip to content

Commit 93fe3ac

Browse files
authored
Update plugin_growatt.py with VPP registers
Added VPP registers to control battery first and grid first without the need to set timers. Also added State of Health register. These changes are for GEN3 inverters, but may also apply to other inverters.
1 parent 020ac3d commit 93fe3ac

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

custom_components/solax_modbus/plugin_growatt.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,34 @@ def value_function_inverter_module(initval, descr, datadict):
966966
# Normal number types
967967
#
968968
###
969+
GrowattModbusNumberEntityDescription(
970+
name = "VPP Time",
971+
key = "vpp_time",
972+
register = 30408,
973+
fmt = "i",
974+
native_min_value = 0,
975+
native_max_value = 1440,
976+
native_step = 5,
977+
native_unit_of_measurement = UnitOfTime.MINUTES,
978+
allowedtypes = GEN3,
979+
entity_category = EntityCategory.CONFIG,
980+
entity_registry_enabled_default = True,
981+
icon = "mdi:battery-clock",
982+
),
983+
GrowattModbusNumberEntityDescription(
984+
name = "VPP Power",
985+
key = "vpp_power",
986+
register = 30409,
987+
fmt = "i",
988+
native_min_value = -100,
989+
native_max_value = 100,
990+
native_step = 5,
991+
native_unit_of_measurement = PERCENTAGE,
992+
allowedtypes = GEN3,
993+
entity_category = EntityCategory.CONFIG,
994+
entity_registry_enabled_default = True,
995+
icon = "mdi:battery-sync",
996+
),
969997
GrowattModbusNumberEntityDescription(
970998
name = "Active Power Limit",
971999
key = "active_power_limit",
@@ -1248,6 +1276,30 @@ def value_function_inverter_module(initval, descr, datadict):
12481276
# Normal select types
12491277
#
12501278
###
1279+
GrowattModbusSelectEntityDescription(
1280+
name = "VPP Status",
1281+
key = "vpp_status",
1282+
register = 30100,
1283+
option_dict = {
1284+
0: "Disabled",
1285+
1: "Enabled", },
1286+
allowedtypes = GEN3 | GEN4,
1287+
entity_category = EntityCategory.CONFIG,
1288+
entity_registry_enabled_default = True,
1289+
icon = "mdi:dip-switch",
1290+
),
1291+
GrowattModbusSelectEntityDescription(
1292+
name = "VPP Remote Control",
1293+
key = "vpp_remote_control",
1294+
register = 30407,
1295+
option_dict = {
1296+
0: "Disabled",
1297+
1: "Enabled", },
1298+
allowedtypes = GEN3,
1299+
entity_category = EntityCategory.CONFIG,
1300+
entity_registry_enabled_default = True,
1301+
icon = "mdi:dip-switch",
1302+
),
12511303
GrowattModbusSelectEntityDescription(
12521304
name = "Inverter Switch",
12531305
key = "inverter_switch",
@@ -2399,6 +2451,49 @@ def value_function_inverter_module(initval, descr, datadict):
23992451
# ================================= Sensor Declarations ============================================================
24002452

24012453
SENSOR_TYPES: list[GrowattModbusSensorEntityDescription] = [
2454+
GrowattModbusSensorEntityDescription(
2455+
key = "vpp_status",
2456+
register = 30100,
2457+
scale = { 0: "Disabled",
2458+
1: "Enabled", },
2459+
allowedtypes = GEN3,
2460+
internal = True,
2461+
),
2462+
GrowattModbusSensorEntityDescription(
2463+
key = "vpp_remote_control",
2464+
register = 30407,
2465+
scale = { 0: "Disabled",
2466+
1: "Enabled", },
2467+
allowedtypes = GEN3,
2468+
internal = True,
2469+
),
2470+
GrowattModbusSensorEntityDescription(
2471+
key = "vpp_time",
2472+
register = 30408,
2473+
allowedtypes = GEN3,
2474+
scale = 1,
2475+
internal = True,
2476+
),
2477+
GrowattModbusSensorEntityDescription(
2478+
key = "vpp_power",
2479+
register = 30409,
2480+
unit = REGISTER_S16,
2481+
allowedtypes = GEN3,
2482+
scale = 1,
2483+
internal = True,
2484+
),
2485+
GrowattModbusSensorEntityDescription(
2486+
name = "Battery SOH",
2487+
key = "battery_soh",
2488+
native_unit_of_measurement = PERCENTAGE,
2489+
device_class = SensorDeviceClass.BATTERY,
2490+
register = 31218,
2491+
register_type = REG_INPUT,
2492+
allowedtypes = GEN3,
2493+
entity_category = EntityCategory.DIAGNOSTIC,
2494+
entity_registry_enabled_default = True,
2495+
icon = "mdi:information",
2496+
),
24022497
GrowattModbusSensorEntityDescription(
24032498
key = "inverter_switch",
24042499
register = 0,

0 commit comments

Comments
 (0)