From 58c26d26bb5cec0b58465cfbe00f81e8927b6bbb Mon Sep 17 00:00:00 2001 From: MartB Date: Sun, 3 Nov 2024 21:52:10 +0100 Subject: [PATCH] H3: add BMS kWh remaining and cell high/low temps cell_mv is returned as V * 10, which results in low resolution, making it unsuitable for meaningful analysis. See #704. --- .../entities/entity_descriptions.py | 5 +++ ...ty_descriptions_for_model[Inv.AIO_H3].json | 36 +++++++++++++++++++ ...entity_descriptions_for_model[Inv.H3].json | 36 +++++++++++++++++++ ..._descriptions_for_model[Inv.KUARA_H3].json | 36 +++++++++++++++++++ 4 files changed, 113 insertions(+) diff --git a/custom_components/foxess_modbus/entities/entity_descriptions.py b/custom_components/foxess_modbus/entities/entity_descriptions.py index 1fff3311..078abf3c 100644 --- a/custom_components/foxess_modbus/entities/entity_descriptions.py +++ b/custom_components/foxess_modbus/entities/entity_descriptions.py @@ -2131,22 +2131,27 @@ def _inner( bms_cell_temp_high=[ ModbusAddressesSpec(input=[11043], models=Inv.H1_G1 | Inv.KH_PRE119), ModbusAddressesSpec(holding=[37617], models=Inv.H1_G2_144 | Inv.KH_PRE133 | Inv.KH_133), + ModbusAddressesSpec(holding=[31102], models=Inv.H3_SET), ], bms_cell_temp_low=[ ModbusAddressesSpec(input=[11044], models=Inv.H1_G1 | Inv.KH_PRE119), ModbusAddressesSpec(holding=[37618], models=Inv.H1_G2_144 | Inv.KH_PRE133 | Inv.KH_133), + ModbusAddressesSpec(holding=[31103], models=Inv.H3_SET), ], bms_cell_mv_high=[ ModbusAddressesSpec(input=[11045], models=Inv.H1_G1 | Inv.KH_PRE119), ModbusAddressesSpec(holding=[37619], models=Inv.H1_G2_144 | Inv.KH_PRE133 | Inv.KH_133), + # ModbusAddressesSpec(holding=[31100], models=Inv.H3_SET), provided in V * 10 aka 32 for 3200mV ], bms_cell_mv_low=[ ModbusAddressesSpec(input=[11046], models=Inv.H1_G1 | Inv.KH_PRE119), ModbusAddressesSpec(holding=[37620], models=Inv.H1_G2_144 | Inv.KH_PRE133 | Inv.KH_133), + # ModbusAddressesSpec(holding=[31101], models=Inv.H3_SET), provided in V * 10 aka 32 for 3200mV ], bms_kwh_remaining=[ ModbusAddressesSpec(input=[11037], models=Inv.H1_G1 | Inv.KH_PRE119), ModbusAddressesSpec(holding=[37632], models=Inv.H1_G2_SET | Inv.KH_PRE133 | Inv.KH_133), + ModbusAddressesSpec(holding=[31123], models=Inv.H3_SET), ], ) yield from _inner( diff --git a/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.AIO_H3].json b/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.AIO_H3].json index b1cddbe0..b437061e 100644 --- a/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.AIO_H3].json +++ b/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.AIO_H3].json @@ -145,6 +145,42 @@ "signed": true, "type": "sensor" }, + { + "addresses": { + "holding": [ + 31102 + ] + }, + "key": "bms_cell_temp_high", + "name": "BMS Cell Temp High", + "scale": 0.1, + "signed": true, + "type": "sensor" + }, + { + "addresses": { + "holding": [ + 31103 + ] + }, + "key": "bms_cell_temp_low", + "name": "BMS Cell Temp Low", + "scale": 0.1, + "signed": true, + "type": "sensor" + }, + { + "addresses": { + "holding": [ + 31123 + ] + }, + "key": "bms_kwh_remaining", + "name": "BMS kWh Remaining", + "scale": 0.01, + "signed": false, + "type": "sensor" + }, { "addresses": { "holding": [ diff --git a/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.H3].json b/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.H3].json index b1cddbe0..b437061e 100644 --- a/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.H3].json +++ b/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.H3].json @@ -145,6 +145,42 @@ "signed": true, "type": "sensor" }, + { + "addresses": { + "holding": [ + 31102 + ] + }, + "key": "bms_cell_temp_high", + "name": "BMS Cell Temp High", + "scale": 0.1, + "signed": true, + "type": "sensor" + }, + { + "addresses": { + "holding": [ + 31103 + ] + }, + "key": "bms_cell_temp_low", + "name": "BMS Cell Temp Low", + "scale": 0.1, + "signed": true, + "type": "sensor" + }, + { + "addresses": { + "holding": [ + 31123 + ] + }, + "key": "bms_kwh_remaining", + "name": "BMS kWh Remaining", + "scale": 0.01, + "signed": false, + "type": "sensor" + }, { "addresses": { "holding": [ diff --git a/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.KUARA_H3].json b/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.KUARA_H3].json index b1cddbe0..b437061e 100644 --- a/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.KUARA_H3].json +++ b/tests/__snapshots__/test_entity_descriptions/test_entity_descriptions_for_model[Inv.KUARA_H3].json @@ -145,6 +145,42 @@ "signed": true, "type": "sensor" }, + { + "addresses": { + "holding": [ + 31102 + ] + }, + "key": "bms_cell_temp_high", + "name": "BMS Cell Temp High", + "scale": 0.1, + "signed": true, + "type": "sensor" + }, + { + "addresses": { + "holding": [ + 31103 + ] + }, + "key": "bms_cell_temp_low", + "name": "BMS Cell Temp Low", + "scale": 0.1, + "signed": true, + "type": "sensor" + }, + { + "addresses": { + "holding": [ + 31123 + ] + }, + "key": "bms_kwh_remaining", + "name": "BMS kWh Remaining", + "scale": 0.01, + "signed": false, + "type": "sensor" + }, { "addresses": { "holding": [