Support current and voltage of up to 4 MPP trackers

This commit is contained in:
farmio 2025-03-08 14:29:20 +01:00
parent 62c025fd12
commit 4747993880
4 changed files with 51 additions and 11 deletions

View File

@ -4,13 +4,13 @@
"current_dc": {
"default": "mdi:current-dc"
},
"current_dc_2": {
"current_dc_mppt_no": {
"default": "mdi:current-dc"
},
"voltage_dc": {
"default": "mdi:current-dc"
},
"voltage_dc_2": {
"voltage_dc_mppt_no": {
"default": "mdi:current-dc"
},
"co2_factor": {

View File

@ -168,6 +168,26 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
translation_key="current_dc_mppt_no",
translation_placeholders={"mppt_no": "2"},
),
FroniusSensorEntityDescription(
key="current_dc_3",
default_value=0,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
translation_key="current_dc_mppt_no",
translation_placeholders={"mppt_no": "3"},
),
FroniusSensorEntityDescription(
key="current_dc_4",
default_value=0,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
translation_key="current_dc_mppt_no",
translation_placeholders={"mppt_no": "4"},
),
FroniusSensorEntityDescription(
key="power_ac",
@ -197,6 +217,26 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
translation_key="voltage_dc_mppt_no",
translation_placeholders={"mppt_no": "2"},
),
FroniusSensorEntityDescription(
key="voltage_dc_3",
default_value=0,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
translation_key="voltage_dc_mppt_no",
translation_placeholders={"mppt_no": "3"},
),
FroniusSensorEntityDescription(
key="voltage_dc_4",
default_value=0,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
translation_key="voltage_dc_mppt_no",
translation_placeholders={"mppt_no": "4"},
),
# device status entities
FroniusSensorEntityDescription(
@ -727,7 +767,7 @@ class _FroniusSensorEntity(CoordinatorEntity["FroniusCoordinatorBase"], SensorEn
self.response_key = description.response_key or description.key
self.solar_net_id = solar_net_id
self._attr_native_value = self._get_entity_value()
self._attr_translation_key = description.key
self._attr_translation_key = description.translation_key or description.key
def _device_data(self) -> dict[str, Any]:
"""Extract information for SolarNet device from coordinator data."""

View File

@ -52,8 +52,8 @@
"current_dc": {
"name": "DC current"
},
"current_dc_2": {
"name": "DC current 2"
"current_dc_mppt_no": {
"name": "DC current {mppt_no}"
},
"power_ac": {
"name": "AC power"
@ -64,8 +64,8 @@
"voltage_dc": {
"name": "DC voltage"
},
"voltage_dc_2": {
"name": "DC voltage 2"
"voltage_dc_mppt_no": {
"name": "DC voltage {mppt_no}"
},
"inverter_state": {
"name": "Inverter state"

View File

@ -238,7 +238,7 @@
'platform': 'fronius',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'current_dc_2',
'translation_key': 'current_dc_mppt_no',
'unique_id': '12345678-current_dc_2',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
})
@ -342,7 +342,7 @@
'platform': 'fronius',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'voltage_dc_2',
'translation_key': 'voltage_dc_mppt_no',
'unique_id': '12345678-voltage_dc_2',
'unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
})
@ -3798,7 +3798,7 @@
'platform': 'fronius',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'current_dc_2',
'translation_key': 'current_dc_mppt_no',
'unique_id': '12345678-current_dc_2',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
})
@ -3902,7 +3902,7 @@
'platform': 'fronius',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'voltage_dc_2',
'translation_key': 'voltage_dc_mppt_no',
'unique_id': '12345678-voltage_dc_2',
'unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
})