Skip to content

Commit 3e01bdd

Browse files
authored
Merge pull request #2076 from TCWORLD/fix-gen6-mppt3
Fix handling for SolaX GEN6 MPPT3 and MPPT4 registers (protocol<100)
2 parents 69e7e69 + cd65de9 commit 3e01bdd

1 file changed

Lines changed: 153 additions & 6 deletions

File tree

custom_components/solax_modbus/plugin_solax.py

Lines changed: 153 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6884,7 +6884,19 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
68846884
scale=0.1,
68856885
register_type=REG_INPUT,
68866886
rounding=1,
6887-
allowedtypes=HYBRID | GEN5 | GEN6 | MPPT4 | MPPT5 | MPPT6,
6887+
allowedtypes=HYBRID | GEN5 | MPPT4 | MPPT5 | MPPT6,
6888+
),
6889+
SolaXModbusSensorEntityDescription(
6890+
name="PV Voltage 4",
6891+
key="pv_voltage_4",
6892+
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
6893+
device_class=SensorDeviceClass.VOLTAGE,
6894+
register=0x28,
6895+
scale=0.1,
6896+
register_type=REG_INPUT,
6897+
rounding=1,
6898+
modbus_min=100,
6899+
allowedtypes=HYBRID | GEN6 | MPPT4,
68886900
),
68896901
SolaXModbusSensorEntityDescription(
68906902
name="PV Voltage 5",
@@ -6908,6 +6920,18 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
69086920
rounding=1,
69096921
allowedtypes=HYBRID | GEN5 | MPPT6,
69106922
),
6923+
SolaXModbusSensorEntityDescription(
6924+
name="PV Voltage 3",
6925+
key="pv_voltage_3",
6926+
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
6927+
device_class=SensorDeviceClass.VOLTAGE,
6928+
register=0x2A,
6929+
scale=0.1,
6930+
register_type=REG_INPUT,
6931+
rounding=1,
6932+
modbus_max=99,
6933+
allowedtypes=HYBRID | GEN6 | MPPT3 | MPPT4,
6934+
),
69116935
SolaXModbusSensorEntityDescription(
69126936
name="PV Current 4",
69136937
key="pv_current_4",
@@ -6917,7 +6941,33 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
69176941
register_type=REG_INPUT,
69186942
scale=0.1,
69196943
rounding=1,
6920-
allowedtypes=HYBRID | GEN5 | GEN6 | MPPT4 | MPPT5 | MPPT6,
6944+
allowedtypes=HYBRID | GEN5 | MPPT4 | MPPT5 | MPPT6,
6945+
icon="mdi:current-dc",
6946+
),
6947+
SolaXModbusSensorEntityDescription(
6948+
name="PV Current 4",
6949+
key="pv_current_4",
6950+
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
6951+
device_class=SensorDeviceClass.CURRENT,
6952+
register=0x2B,
6953+
register_type=REG_INPUT,
6954+
scale=0.1,
6955+
rounding=1,
6956+
modbus_min=100,
6957+
allowedtypes=HYBRID | GEN6 | MPPT4,
6958+
icon="mdi:current-dc",
6959+
),
6960+
SolaXModbusSensorEntityDescription(
6961+
name="PV Current 3",
6962+
key="pv_current_3",
6963+
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
6964+
device_class=SensorDeviceClass.CURRENT,
6965+
register=0x2B,
6966+
register_type=REG_INPUT,
6967+
scale=0.1,
6968+
rounding=1,
6969+
modbus_max=99,
6970+
allowedtypes=HYBRID | GEN6 | MPPT3 | MPPT4,
69216971
icon="mdi:current-dc",
69226972
),
69236973
SolaXModbusSensorEntityDescription(
@@ -6932,6 +6982,18 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
69326982
allowedtypes=HYBRID | GEN5 | MPPT5 | MPPT6,
69336983
icon="mdi:current-dc",
69346984
),
6985+
SolaXModbusSensorEntityDescription(
6986+
name="PV Power 3",
6987+
key="pv_power_3",
6988+
native_unit_of_measurement=UnitOfPower.WATT,
6989+
device_class=SensorDeviceClass.POWER,
6990+
state_class=SensorStateClass.MEASUREMENT,
6991+
register=0x2C,
6992+
register_type=REG_INPUT,
6993+
modbus_max=99,
6994+
allowedtypes=HYBRID | GEN6 | MPPT3 | MPPT4,
6995+
icon="mdi:solar-power-variant",
6996+
),
69356997
SolaXModbusSensorEntityDescription(
69366998
name="PV Current 6",
69376999
key="pv_current_6",
@@ -6952,9 +7014,33 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
69527014
state_class=SensorStateClass.MEASUREMENT,
69537015
register=0x2E,
69547016
register_type=REG_INPUT,
6955-
allowedtypes=HYBRID | GEN5 | GEN6 | MPPT4 | MPPT5 | MPPT6,
7017+
allowedtypes=HYBRID | GEN5 | MPPT4 | MPPT5 | MPPT6,
7018+
icon="mdi:solar-power-variant",
7019+
),
7020+
SolaXModbusSensorEntityDescription(
7021+
name="PV Power 4",
7022+
key="pv_power_4",
7023+
native_unit_of_measurement=UnitOfPower.WATT,
7024+
device_class=SensorDeviceClass.POWER,
7025+
state_class=SensorStateClass.MEASUREMENT,
7026+
register=0x2E,
7027+
register_type=REG_INPUT,
7028+
modbus_min=100,
7029+
allowedtypes=HYBRID | GEN6 | MPPT4,
69567030
icon="mdi:solar-power-variant",
69577031
),
7032+
SolaXModbusSensorEntityDescription(
7033+
name="PV Voltage 4",
7034+
key="pv_voltage_4",
7035+
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
7036+
device_class=SensorDeviceClass.VOLTAGE,
7037+
register=0x2E,
7038+
scale=0.1,
7039+
register_type=REG_INPUT,
7040+
rounding=1,
7041+
modbus_max=99,
7042+
allowedtypes=HYBRID | GEN6 | MPPT4,
7043+
),
69587044
SolaXModbusSensorEntityDescription(
69597045
name="PV Power 5",
69607046
key="pv_power_5",
@@ -6966,6 +7052,19 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
69667052
allowedtypes=HYBRID | GEN5 | MPPT5 | MPPT6,
69677053
icon="mdi:solar-power-variant",
69687054
),
7055+
SolaXModbusSensorEntityDescription(
7056+
name="PV Current 4",
7057+
key="pv_current_4",
7058+
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
7059+
device_class=SensorDeviceClass.CURRENT,
7060+
register=0x2F,
7061+
register_type=REG_INPUT,
7062+
scale=0.1,
7063+
rounding=1,
7064+
modbus_max=99,
7065+
allowedtypes=HYBRID | GEN6 | MPPT4,
7066+
icon="mdi:current-dc",
7067+
),
69697068
SolaXModbusSensorEntityDescription(
69707069
name="PV Power 6",
69717070
key="pv_power_6",
@@ -6977,6 +7076,18 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
69777076
allowedtypes=HYBRID | GEN5 | MPPT6,
69787077
icon="mdi:solar-power-variant",
69797078
),
7079+
SolaXModbusSensorEntityDescription(
7080+
name="PV Power 4",
7081+
key="pv_power_4",
7082+
native_unit_of_measurement=UnitOfPower.WATT,
7083+
device_class=SensorDeviceClass.POWER,
7084+
state_class=SensorStateClass.MEASUREMENT,
7085+
register=0x30,
7086+
register_type=REG_INPUT,
7087+
modbus_max=99,
7088+
allowedtypes=HYBRID | GEN6 | MPPT4,
7089+
icon="mdi:solar-power-variant",
7090+
),
69807091
# V001.00 system-info register. Keep the existing calculated pv_power_total
69817092
# as the primary entity because this register returns 0 on some tested units.
69827093
SolaXModbusSensorEntityDescription(
@@ -8661,7 +8772,19 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
86618772
scale=0.1,
86628773
register_type=REG_INPUT,
86638774
rounding=1,
8664-
allowedtypes=HYBRID | GEN5 | GEN6 | MPPT3 | MPPT4 | MPPT5 | MPPT6,
8775+
allowedtypes=HYBRID | GEN5 | MPPT3 | MPPT4 | MPPT5 | MPPT6,
8776+
),
8777+
SolaXModbusSensorEntityDescription(
8778+
name="PV Voltage 3",
8779+
key="pv_voltage_3",
8780+
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
8781+
device_class=SensorDeviceClass.VOLTAGE,
8782+
register=0x122,
8783+
scale=0.1,
8784+
register_type=REG_INPUT,
8785+
rounding=1,
8786+
modbus_min=100,
8787+
allowedtypes=HYBRID | GEN6 | MPPT3 | MPPT4,
86658788
),
86668789
SolaXModbusSensorEntityDescription(
86678790
name="PV Current 3",
@@ -8671,9 +8794,32 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
86718794
register=0x123,
86728795
scale=0.1,
86738796
register_type=REG_INPUT,
8674-
allowedtypes=HYBRID | GEN5 | GEN6 | MPPT3 | MPPT4 | MPPT5 | MPPT6,
8797+
allowedtypes=HYBRID | GEN5 | MPPT3 | MPPT4 | MPPT5 | MPPT6,
86758798
icon="mdi:current-dc",
86768799
),
8800+
SolaXModbusSensorEntityDescription(
8801+
name="PV Current 3",
8802+
key="pv_current_3",
8803+
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
8804+
device_class=SensorDeviceClass.CURRENT,
8805+
register=0x123,
8806+
scale=0.1,
8807+
register_type=REG_INPUT,
8808+
modbus_min=100,
8809+
allowedtypes=HYBRID | GEN6 | MPPT3 | MPPT4,
8810+
icon="mdi:current-dc",
8811+
),
8812+
SolaXModbusSensorEntityDescription(
8813+
name="PV Power 3",
8814+
key="pv_power_3",
8815+
native_unit_of_measurement=UnitOfPower.WATT,
8816+
device_class=SensorDeviceClass.POWER,
8817+
state_class=SensorStateClass.MEASUREMENT,
8818+
register=0x124,
8819+
register_type=REG_INPUT,
8820+
allowedtypes=HYBRID | GEN5 | MPPT3 | MPPT4 | MPPT5 | MPPT6,
8821+
icon="mdi:solar-power-variant",
8822+
),
86778823
SolaXModbusSensorEntityDescription(
86788824
name="PV Power 3",
86798825
key="pv_power_3",
@@ -8682,7 +8828,8 @@ def value_function_battery_voltage_cell_difference(initval: int, descr: Any, dat
86828828
state_class=SensorStateClass.MEASUREMENT,
86838829
register=0x124,
86848830
register_type=REG_INPUT,
8685-
allowedtypes=HYBRID | GEN5 | GEN6 | MPPT3 | MPPT4 | MPPT5 | MPPT6,
8831+
modbus_min=100,
8832+
allowedtypes=HYBRID | GEN6 | MPPT3 | MPPT4,
86868833
icon="mdi:solar-power-variant",
86878834
),
86888835
SolaXModbusSensorEntityDescription(

0 commit comments

Comments
 (0)