1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-30 04:05:01 +01:00

Add Rated Capacity to Indevolt Gen-1 devices (#171107)

This commit is contained in:
A. Gideonse
2026-05-27 01:09:02 +02:00
committed by GitHub
parent 2a4728463b
commit da74ae1955
4 changed files with 60 additions and 8 deletions
+2 -1
View File
@@ -32,6 +32,7 @@ SENSOR_KEYS: Final[dict[int, list[str]]] = {
IndevoltSystem.OFF_GRID_OUTPUT_ENERGY,
IndevoltSystem.BYPASS_POWER,
IndevoltSystem.BYPASS_INPUT_ENERGY,
IndevoltBattery.RATED_CAPACITY,
IndevoltBattery.DAILY_CHARGING_ENERGY,
IndevoltBattery.DAILY_DISCHARGING_ENERGY,
IndevoltBattery.TOTAL_CHARGING_ENERGY,
@@ -78,7 +79,7 @@ SENSOR_KEYS: Final[dict[int, list[str]]] = {
IndevoltSolar.DC_INPUT_POWER_2,
IndevoltSolar.DC_INPUT_POWER_3,
IndevoltSolar.DC_INPUT_POWER_4,
IndevoltBattery.RATED_CAPACITY_GEN2,
IndevoltBattery.RATED_CAPACITY,
IndevoltSystem.BYPASS_POWER,
IndevoltSystem.TOTAL_OUTPUT_ENERGY,
IndevoltSystem.OFF_GRID_OUTPUT_ENERGY,
+1 -3
View File
@@ -73,12 +73,10 @@ SENSORS: Final = (
device_class=SensorDeviceClass.ENUM,
),
IndevoltSensorEntityDescription(
key=IndevoltBattery.RATED_CAPACITY_GEN2,
generation=(2,),
key=IndevoltBattery.RATED_CAPACITY,
translation_key="rated_capacity",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
IndevoltSensorEntityDescription(
key=IndevoltConfig.READ_DISCHARGE_LIMIT,
@@ -3,6 +3,7 @@
dict({
'coordinator_data': dict({
'11034': 0,
'142': 1.64,
'1501': 0,
'1502': 0,
'1505': 553673,
@@ -1804,6 +1804,61 @@
'state': '0',
})
# ---
# name: test_sensor[1][sensor.bk1600_rated_capacity-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.bk1600_rated_capacity',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Rated capacity',
'options': dict({
'sensor': dict({
'suggested_display_precision': 2,
}),
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Rated capacity',
'platform': 'indevolt',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'rated_capacity',
'unique_id': 'BK1600-12345678_142',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensor[1][sensor.bk1600_rated_capacity-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'BK1600 Rated capacity',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.bk1600_rated_capacity',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '1.64',
})
# ---
# name: test_sensor[1][sensor.bk1600_real_time_mode-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -6360,9 +6415,7 @@
None,
]),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
@@ -6401,7 +6454,6 @@
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'CMS-SF2000 Rated capacity',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,