Skip to content

Commit

Permalink
2024.08.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wills106 committed Aug 4, 2024
1 parent a8f437b commit 6613cfe
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 25 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.08.2"
"version": "2024.08.3"
}
16 changes: 16 additions & 0 deletions custom_components/solax_modbus/plugin_growatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3328,6 +3328,22 @@ def value_function_combined_battery_power(initval, descr, datadict):
),

# TL-X TL-XH
GrowattModbusSensorEntityDescription(
name = "Inverter State",
key = "inverter_state",
register = 3000,
unit = REGISTER_U8H,
scale = { 0: "Waiting", 3: "Fault", 4: "Flash", 5: "PV Bat Online", 6: "Bat Online", },
allowedtypes = GEN3 | GEN4,
),
GrowattModbusSensorEntityDescription(
name = "Run Mode",
key = "run_mode",
register = 3000,
unit = REGISTER_U8L,
scale = { 0: "Standby", 1: "Normal", 3: "Fault", 4: "Flash", },
allowedtypes = GEN3 | GEN4,
),
GrowattModbusSensorEntityDescription(
name = "Total PV Power",
key = "total_pv_power",
Expand Down
12 changes: 6 additions & 6 deletions custom_components/solax_modbus/plugin_solax.py
Original file line number Diff line number Diff line change
Expand Up @@ -2537,7 +2537,7 @@ def value_function_software_version_air_g4(initval, descr, datadict):
key = "registration_code_pocket",
register = 0xAA,
unit = REGISTER_STR,
wordcount=5,
wordcount = 5,
entity_registry_enabled_default = False,
allowedtypes = AC | HYBRID | GEN3 | GEN4 | GEN5,
entity_category = EntityCategory.DIAGNOSTIC,
Expand All @@ -2548,7 +2548,7 @@ def value_function_software_version_air_g4(initval, descr, datadict):
key = "registration_code_lan",
register = 0xAF,
unit = REGISTER_STR,
wordcount=5,
wordcount = 5,
entity_registry_enabled_default = False,
allowedtypes = AC | HYBRID | GEN3,
entity_category = EntityCategory.DIAGNOSTIC,
Expand Down Expand Up @@ -2667,7 +2667,7 @@ def value_function_software_version_air_g4(initval, descr, datadict):
key = "inverter_model_number",
register = 0xE9,
unit = REGISTER_STR,
wordcount=10,
wordcount = 10,
allowedtypes = AC | HYBRID | GEN3,
entity_registry_enabled_default = False,
entity_category = EntityCategory.DIAGNOSTIC,
Expand Down Expand Up @@ -7023,7 +7023,7 @@ def value_function_software_version_air_g4(initval, descr, datadict):
key = "model_number",
register = 0x1A00,
unit = REGISTER_STR,
wordcount=8,
wordcount = 8,
allowedtypes = MAX,
entity_category = EntityCategory.DIAGNOSTIC,
icon = "mdi:information",
Expand All @@ -7033,7 +7033,7 @@ def value_function_software_version_air_g4(initval, descr, datadict):
key = "serial_number",
register = 0x1A10,
unit = REGISTER_STR,
wordcount=8,
wordcount = 8,
allowedtypes = MAX,
entity_category = EntityCategory.DIAGNOSTIC,
icon = "mdi:information",
Expand All @@ -7043,7 +7043,7 @@ def value_function_software_version_air_g4(initval, descr, datadict):
key = "software_version",
register = 0x1A1C,
unit = REGISTER_STR,
wordcount=3,
wordcount = 3,
allowedtypes = MAX,
icon = "mdi:information",
),
Expand Down
161 changes: 143 additions & 18 deletions custom_components/solax_modbus/plugin_solax_mega_forth.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,34 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):

EXPORT_LIMIT_SCALE_EXCEPTIONS = []

NUMBER_TYPES = []
NUMBER_TYPES = [

SolaxModbusNumberEntityDescription(
name = "Active Power",
key = "active_power",
register = 0x2304,
fmt = "i",
native_min_value = 1,
native_max_value = 100,
native_step = 1,
scale = 0.1,
native_unit_of_measurement = PERCENTAGE,
allowedtypes = MAX | GEN2,
),
SolaxModbusNumberEntityDescription(
name = "Reactive Power",
key = "reactive_power",
register = 0x2305,
fmt = "i",
native_min_value = 1,
native_max_value = 100,
native_step = 1,
scale = 0.1,
native_unit_of_measurement = PERCENTAGE,
allowedtypes = MAX | GEN2,
),

]

# ================================= Select Declarations ============================================================

Expand All @@ -129,6 +156,26 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
# Input Registers
#
#####
SolaXModbusSensorEntityDescription(
name = "Model Type",
key = "model_type",
register = 0x12,
unit = REGISTER_STR,
wordcount = 8,
allowedtypes = MAX | GEN2,
entity_category = EntityCategory.DIAGNOSTIC,
icon = "mdi:information",
),
SolaXModbusSensorEntityDescription(
name = "Software Version",
key = "software_version",
register = 0x22,
unit = REGISTER_STR,
wordcount = 8,
allowedtypes = MAX | GEN2,
entity_category = EntityCategory.DIAGNOSTIC,
icon = "mdi:information",
),
SolaXModbusSensorEntityDescription(
name = "Grid Voltage L1",
key = "grid_voltage_l1",
Expand Down Expand Up @@ -213,26 +260,35 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.CURRENT,
register = 0x180,
register_type = REG_INPUT,
scale = 0.01,
rounding = 2,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
),
SolaXModbusSensorEntityDescription(
name = "Measured Power L1",
key = "measured_power_l1",
native_unit_of_measurement = UnitOfPower.WATT,
device_class = SensorDeviceClass.POWER,
state_class = SensorStateClass.MEASUREMENT,
register = 0x1003,
name = "Inverter Current L2",
key = "inverter_current_l2",
native_unit_of_measurement = UnitOfElectricCurrent.AMPERE,
device_class = SensorDeviceClass.CURRENT,
register = 0x181,
register_type = REG_INPUT,
unit = REGISTER_U32,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
),
),
SolaXModbusSensorEntityDescription(
name = "Active Power",
key = "active_power",
name = "Inverter Current L3",
key = "inverter_current_l3",
native_unit_of_measurement = UnitOfElectricCurrent.AMPERE,
device_class = SensorDeviceClass.CURRENT,
register = 0x182,
register_type = REG_INPUT,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
),
SolaXModbusSensorEntityDescription(
name = "Active Power Energy",
key = "active_power_energy",
native_unit_of_measurement = UnitOfPower.WATT,
device_class = SensorDeviceClass.POWER,
state_class = SensorStateClass.MEASUREMENT,
Expand All @@ -257,10 +313,57 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
key = "apparent_power",
native_unit_of_measurement = UnitOfApparentPower.VOLT_AMPERE,
device_class = SensorDeviceClass.APPARENT_POWER,
register = 0x223,
register = 0x187,
register_type = REG_INPUT,
unit = REGISTER_U32,
allowedtypes = MAX | GEN2,
),
SolaXModbusSensorEntityDescription(
name = "Today's Energy",
key = "today_s_energy",
native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR,
device_class = SensorDeviceClass.ENERGY,
state_class = SensorStateClass.TOTAL_INCREASING,
register = 0x189,
register_type = REG_INPUT,
scale = 0.1,
allowedtypes = MAX | GEN2,
),
SolaXModbusSensorEntityDescription(
name = "Total Energy",
key = "total_energy",
native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR,
device_class = SensorDeviceClass.ENERGY,
state_class = SensorStateClass.TOTAL_INCREASING,
register = 0x18A,
register_type = REG_INPUT,
unit = REGISTER_U32,
scale = 0.1,
allowedtypes = MAX | GEN2,
),
SolaXModbusSensorEntityDescription(
name = "Power Factor",
key = "power_factor",
native_unit_of_measurement = None,
device_class = SensorDeviceClass.POWER_FACTOR,
state_class = SensorStateClass.MEASUREMENT,
register = 0x18F,
unit = REGISTER_S16,
scale = 0.001,
allowedtypes = MAX | GEN2,
),
SolaXModbusSensorEntityDescription(
name = "Inverter Temperature",
key = "inverter_temperature",
native_unit_of_measurement = UnitOfTemperature.CELSIUS,
device_class = SensorDeviceClass.TEMPERATURE,
state_class = SensorStateClass.MEASUREMENT,
register = 0x28F,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
allowedtypes = MAX | GEN2,
entity_category = EntityCategory.DIAGNOSTIC,
),
SolaXModbusSensorEntityDescription(
name = "PV Voltage 1",
Expand All @@ -269,6 +372,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.VOLTAGE,
register = 0x28B,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
Expand All @@ -280,6 +384,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.CURRENT,
register = 0x28C,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
Expand All @@ -293,7 +398,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
state_class = SensorStateClass.MEASUREMENT,
register = 0x28D,
register_type = REG_INPUT,
unit = REGISTER_U32,
unit = REGISTER_S32,
allowedtypes = MAX | GEN2,
icon = "mdi:solar-power-variant",
),
Expand All @@ -316,6 +421,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.VOLTAGE,
register = 0x292,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
Expand All @@ -327,6 +433,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.CURRENT,
register = 0x293,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
Expand All @@ -340,7 +447,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
state_class = SensorStateClass.MEASUREMENT,
register = 0x294,
register_type = REG_INPUT,
unit = REGISTER_U32,
unit = REGISTER_S32,
allowedtypes = MAX | GEN2,
icon = "mdi:solar-power-variant",
),
Expand All @@ -363,6 +470,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.VOLTAGE,
register = 0x299,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
Expand All @@ -374,6 +482,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.CURRENT,
register = 0x29A,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
Expand All @@ -387,7 +496,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
state_class = SensorStateClass.MEASUREMENT,
register = 0x29B,
register_type = REG_INPUT,
unit = REGISTER_U32,
unit = REGISTER_S32,
allowedtypes = MAX | GEN2,
icon = "mdi:solar-power-variant",
),
Expand All @@ -410,6 +519,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.VOLTAGE,
register = 0x2A0,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
Expand All @@ -421,6 +531,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
device_class = SensorDeviceClass.CURRENT,
register = 0x2A1,
register_type = REG_INPUT,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
allowedtypes = MAX | GEN2,
Expand All @@ -434,7 +545,7 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
state_class = SensorStateClass.MEASUREMENT,
register = 0x2A2,
register_type = REG_INPUT,
unit = REGISTER_U32,
unit = REGISTER_S32,
allowedtypes = MAX | GEN2,
icon = "mdi:solar-power-variant",
),
Expand All @@ -450,6 +561,20 @@ class SolaXModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
allowedtypes = MAX | GEN2,
entity_category = EntityCategory.DIAGNOSTIC,
),
SolaXModbusSensorEntityDescription(
key = "active_power",
register = 0x2304,
scale = 0.1,
allowedtypes = MAX | GEN2,
internal = True,
),
SolaXModbusSensorEntityDescription(
key = "reactive_power",
register = 0x2305,
scale = 0.1,
allowedtypes = MAX | GEN2,
internal = True,
),
]

# ============================ plugin declaration =================================================
Expand Down

0 comments on commit 6613cfe

Please sign in to comment.