Skip to content

Commit

Permalink
2024.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wills106 committed Oct 13, 2024
1 parent 8b721cd commit 82cf023
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 28 deletions.
2 changes: 1 addition & 1 deletion custom_components/solax_modbus/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/wills106/homsassistant-solax-modbus/issues",
"requirements": ["pymodbus>=3.6.8"],
"version": "2024.10.1.1"
"version": "2024.10.2"
}
51 changes: 51 additions & 0 deletions custom_components/solax_modbus/plugin_growatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ def value_function_combined_battery_power(initval, descr, datadict):
# ================================= Button Declarations ============================================================

BUTTON_TYPES = [
GrowattModbusButtonEntityDescription(
name = "Active Power Not Limited",
key = "active_power_not_limited",
register = 3,
command = 255,
allowedtypes = ALL_GEN_GROUP,
icon = "mdi:gauge-full",
),
GrowattModbusButtonEntityDescription(
name = "Reactive Power Not Limited",
key = "reactive_power_not_limited",
register = 4,
command = 255,
allowedtypes = ALL_GEN_GROUP,
icon = "mdi:gauge-full",
),
GrowattModbusButtonEntityDescription(
name = "Sync RTC",
key = "sync_rtc",
Expand All @@ -141,6 +157,28 @@ def value_function_combined_battery_power(initval, descr, datadict):
# Normal number types
#
###
GrowattModbusNumberEntityDescription(
name = "Active Power Limit",
key = "active_power_limit",
register = 3,
fmt = "i",
native_min_value = 0,
native_max_value = 100,
native_step = 1,
native_unit_of_measurement = PERCENTAGE,
allowedtypes = ALL_GEN_GROUP,
),
GrowattModbusNumberEntityDescription(
name = "Reactive Power Limit",
key = "reactive_power_limit",
register = 4,
fmt = "i",
native_min_value = -100,
native_max_value = 100,
native_step = 1,
native_unit_of_measurement = PERCENTAGE,
allowedtypes = ALL_GEN_GROUP,
),
GrowattModbusNumberEntityDescription(
name = "Grid Export Limit",
key = "grid_export_limit",
Expand Down Expand Up @@ -987,6 +1025,19 @@ def value_function_combined_battery_power(initval, descr, datadict):
# ================================= Sennsor Declarations ============================================================

SENSOR_TYPES: list[GrowattModbusSensorEntityDescription] = [
GrowattModbusSensorEntityDescription(
key = "active_power_limit",
register = 3,
allowedtypes = ALL_GEN_GROUP,
internal = True,
),
GrowattModbusSensorEntityDescription(
key = "reactive_power_limit",
register = 4,
unit = REGISTER_S16,
allowedtypes = ALL_GEN_GROUP,
internal = True,
),
GrowattModbusSensorEntityDescription(
name = "Firmware Version",
key = "firmware_version",
Expand Down
156 changes: 129 additions & 27 deletions custom_components/solax_modbus/plugin_solax.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,30 @@ def value_function_battery_voltage_cell_difference(initval, descr, datadict):
device_class = NumberDeviceClass.POWER,
allowedtypes = MIC | GEN2 | X3,
),
SolaxModbusNumberEntityDescription(
name = "Export Power Limit",
key = "export_power_limit",
register = 0x65C,
fmt = "i",
native_min_value = 0,
native_max_value = 30000,
native_step = 100,
native_unit_of_measurement = UnitOfPower.WATT,
device_class = NumberDeviceClass.POWER,
allowedtypes = MIC | GEN2 | X3,
),
SolaxModbusNumberEntityDescription(
name = "Active Power Limit",
key = "active_power_limit",
register = 0x669,
fmt = "i",
native_min_value = 0,
native_max_value = 30000,
native_step = 100,
native_unit_of_measurement = UnitOfPower.WATT,
device_class = NumberDeviceClass.POWER,
allowedtypes = MIC | GEN4,
),
]

# ================================= Select Declarations ============================================================
Expand Down Expand Up @@ -2053,6 +2077,42 @@ def value_function_battery_voltage_cell_difference(initval, descr, datadict):
# MIC
#
#####
SolaxModbusSelectEntityDescription(
name = "Lock State",
key = "lock_state",
register = 0x600,
option_dict = {
0: "Locked",
2014: "Unlocked",
6868: "Unlocked - Advanced",
},
allowedtypes = MIC | GEN2 | GEN4,
icon = "mdi:lock-question",
),
SolaxModbusSelectEntityDescription(
name = "MPPT Scan Mode PV1",
key = "mppt_scan_mode_pv1",
register = 0x601,
option_dict = {
0: "Off",
1: "Low",
2: "Middle",
3: "High",
},
allowedtypes = MIC | GEN4,
icon = "mdi:dip-switch",
),
#SolaxModbusSelectEntityDescription(
# name = "MPPT",
# key = "mppt",
# register = 0x602,
# option_dict = {
# 0: "Enabled",
# 1: "Disabled",
# },
# allowedtypes = HYBRID | GEN4,
# icon = "mdi:dip-switch",
#),
SolaxModbusSelectEntityDescription(
name = "Q Curve",
key = "q-curve",
Expand Down Expand Up @@ -2080,20 +2140,34 @@ def value_function_battery_voltage_cell_difference(initval, descr, datadict):
4: "Q(u)",
5: "FixQPower",
},
allowedtypes = MIC | GEN2,
allowedtypes = MIC | GEN2 | X3,
icon = "mdi:dip-switch",
),
SolaxModbusSelectEntityDescription(
name = "Lock State",
key = "lock_state",
register = 0x600,
name = "MPPT Scan Mode PV2",
key = "mppt_scan_mode_pv2",
register = 0x6A6,
option_dict = {
0: "Locked",
2014: "Unlocked",
6868: "Unlocked - Advanced",
0: "Off",
1: "Low",
2: "Middle",
3: "High",
},
allowedtypes = MIC | GEN2,
icon = "mdi:lock-question",
allowedtypes = MIC | GEN4,
icon = "mdi:dip-switch",
),
SolaxModbusSelectEntityDescription(
name = "MPPT Scan Mode PV3",
key = "mppt_scan_mode_pv3",
register = 0x6A7,
option_dict = {
0: "Off",
1: "Low",
2: "Middle",
3: "High",
},
allowedtypes = MIC | GEN4 |MPPT3,
icon = "mdi:dip-switch",
),
]

Expand Down Expand Up @@ -6023,6 +6097,20 @@ def value_function_battery_voltage_cell_difference(initval, descr, datadict):
entity_category = EntityCategory.DIAGNOSTIC,
icon = "mdi:clock",
),
SolaXModbusSensorEntityDescription(
key = "firmware_dsp",
register = 0x33D,
allowedtypes = MIC | GEN,
blacklist=('MU802T',),
internal = True,
),
SolaXModbusSensorEntityDescription(
key = "firmware_arm",
register = 0x33E,
allowedtypes = MIC | GEN,
blacklist=('MU802T',),
internal = True,
),
SolaXModbusSensorEntityDescription(
key = "q-curve",
register = 0x347,
Expand All @@ -6032,29 +6120,13 @@ def value_function_battery_voltage_cell_difference(initval, descr, datadict):
3: "PF(p)",
4: "Q(u)",
5: "FixQPower", },
allowedtypes = MIC | GEN2,
allowedtypes = MIC | GEN2 | X3,
internal = True,
),
SolaXModbusSensorEntityDescription(
name = "Active Power Limit",
key = "active_power_limit",
native_unit_of_measurement = UnitOfPower.WATT,
device_class = SensorDeviceClass.POWER,
register = 0x351,
allowedtypes = MIC | GEN2 | X3,
),
SolaXModbusSensorEntityDescription(
key = "firmware_dsp",
register = 0x33D,
allowedtypes = MIC | GEN,
blacklist=('MU802T',),
internal = True,
),
SolaXModbusSensorEntityDescription(
key = "firmware_arm",
register = 0x33E,
allowedtypes = MIC | GEN,
blacklist=('MU802T',),
internal = True,
),
SolaXModbusSensorEntityDescription(
Expand Down Expand Up @@ -6092,7 +6164,7 @@ def value_function_battery_voltage_cell_difference(initval, descr, datadict):
scale = { 0: "Locked",
1: "Unlocked",
2: "Unlocked - Advanced", },
allowedtypes = MIC | GEN2 | X1,
allowedtypes = MIC | GEN2 | GEN4 | X1,
internal = True,
),
#####
Expand Down Expand Up @@ -6658,6 +6730,16 @@ def value_function_battery_voltage_cell_difference(initval, descr, datadict):
# Holding Registers
#
#####
SolaXModbusSensorEntityDescription(
key = "mppt_scan_mode_pv1",
register = 0x320,
scale = { 0: "Off",
1: "Low",
2: "Middle",
3: "High", },
allowedtypes = MIC | GEN4,
internal = True,
),
SolaXModbusSensorEntityDescription(
key = "q-curve",
register = 0x35C,
Expand Down Expand Up @@ -6690,6 +6772,26 @@ def value_function_battery_voltage_cell_difference(initval, descr, datadict):
allowedtypes = MIC | GEN4,
internal = True,
),
SolaXModbusSensorEntityDescription(
key = "mppt_scan_mode_pv2",
register = 0x3A6,
scale = { 0: "Off",
1: "Low",
2: "Middle",
3: "High", },
allowedtypes = MIC | GEN4,
internal = True,
),
SolaXModbusSensorEntityDescription(
key = "mppt_scan_mode_pv3",
register = 0x3A7,
scale = { 0: "Off",
1: "Low",
2: "Middle",
3: "High", },
allowedtypes = MIC | GEN4 | MPPT3,
internal = True,
),
#####
#
# Input Registers
Expand Down
5 changes: 5 additions & 0 deletions custom_components/solax_modbus/plugin_solax_mega_forth.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,11 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
allowedtypes = MAX | GEN2 | MPPT12,
entity_category = EntityCategory.DIAGNOSTIC,
),
#####
#
# Holding Registers
#
#####
SolaXModbusSensorEntityDescription(
key = "active_power_control",
register = 0x2304,
Expand Down

0 comments on commit 82cf023

Please sign in to comment.