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

Add SOH for some inverters, implements #687 #703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions custom_components/foxess_modbus/entities/entity_descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,7 @@ def _inner(
batvolt: list[ModbusAddressesSpec],
bat_current: list[ModbusAddressesSpec],
battery_soc: list[ModbusAddressesSpec],
battery_soh: list[ModbusAddressesSpec],
battery_temp: list[ModbusAddressesSpec],
bms_cell_temp_high: list[ModbusAddressesSpec],
bms_cell_temp_low: list[ModbusAddressesSpec],
Expand Down Expand Up @@ -1954,6 +1955,17 @@ def _inner(
signed=False,
validate=[Range(0, 100)],
)
yield ModbusBatterySensorDescription(
key=f"battery_soh{key_suffix}",
addresses=battery_soh,
bms_connect_state_address=bms_connect_state_address,
name=f"Battery{name_infix} SoH",
device_class=SensorDeviceClass.BATTERY,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement="%",
signed=False,
validate=[Range(0, 100)],
)
yield ModbusBatterySensorDescription(
key=f"battery_temp{key_suffix}",
addresses=battery_temp,
Expand Down Expand Up @@ -2040,6 +2052,11 @@ def _inner(
ModbusAddressesSpec(holding=[31024], models=Inv.H1_G1 | Inv.H1_LAN | Inv.H1_G2 | Inv.KH_119),
ModbusAddressesSpec(holding=[31038], models=Inv.H3_SET),
],
battery_soh=[
ModbusAddressesSpec(input=[11104], models=Inv.KH_PRE119),
ModbusAddressesSpec(holding=[37624], models=Inv.H1_G2 | Inv.KH_119),
ModbusAddressesSpec(holding=[31090], models=Inv.H3_SET),
],
battery_temp=[
ModbusAddressesSpec(input=[11038], models=Inv.H1_G1 | Inv.KH_PRE119),
ModbusAddressesSpec(holding=[31023], models=Inv.H1_G1 | Inv.H1_LAN | Inv.H1_G2 | Inv.KH_119),
Expand Down Expand Up @@ -2068,6 +2085,7 @@ def _inner(
batvolt=[ModbusAddressesSpec(holding=[37609], models=Inv.H3_PRO)],
bat_current=[ModbusAddressesSpec(holding=[37610], models=Inv.H3_PRO)],
battery_soc=[ModbusAddressesSpec(holding=[37612], models=Inv.H3_PRO)],
battery_soh=[ModbusAddressesSpec(holding=[37624], models=Inv.H3_PRO)],
battery_temp=[ModbusAddressesSpec(holding=[37611], models=Inv.H3_PRO)],
bms_cell_temp_high=[ModbusAddressesSpec(holding=[37617], models=Inv.H3_PRO)],
bms_cell_temp_low=[ModbusAddressesSpec(holding=[37618], models=Inv.H3_PRO)],
Expand All @@ -2081,6 +2099,7 @@ def _inner(
batvolt=[ModbusAddressesSpec(holding=[38307], models=Inv.H3_PRO)],
bat_current=[ModbusAddressesSpec(holding=[38308], models=Inv.H3_PRO)],
battery_soc=[ModbusAddressesSpec(holding=[38310], models=Inv.H3_PRO)],
battery_soh=[ModbusAddressesSpec(holding=[38322], models=Inv.H3_PRO)],
battery_temp=[ModbusAddressesSpec(holding=[38309], models=Inv.H3_PRO)],
bms_cell_temp_high=[ModbusAddressesSpec(holding=[38315], models=Inv.H3_PRO)],
bms_cell_temp_low=[ModbusAddressesSpec(holding=[38316], models=Inv.H3_PRO)],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
31090
]
},
"key": "battery_soh",
"name": "Battery SoH",
"scale": null,
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
37624
]
},
"key": "battery_soh",
"name": "Battery SoH",
"scale": null,
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
31090
]
},
"key": "battery_soh",
"name": "Battery SoH",
"scale": null,
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,30 @@
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
37624
]
},
"key": "battery_soh_1",
"name": "Battery 1 SoH",
"scale": null,
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
38322
]
},
"key": "battery_soh_2",
"name": "Battery 2 SoH",
"scale": null,
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
37624
]
},
"key": "battery_soh",
"name": "Battery SoH",
"scale": null,
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
"signed": false,
"type": "sensor"
},
{
"addresses": {
"input": [
11104
]
},
"key": "battery_soh",
"name": "Battery SoH",
"scale": null,
"signed": false,
"type": "sensor"
},
{
"addresses": {
"input": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
31090
]
},
"key": "battery_soh",
"name": "Battery SoH",
"scale": null,
"signed": false,
"type": "sensor"
},
{
"addresses": {
"holding": [
Expand Down
Loading