diff --git a/__init__.py b/__init__.py index c7a6a4f..f4aa92c 100644 --- a/__init__.py +++ b/__init__.py @@ -454,8 +454,4 @@ async def _create_configuration_update_coordinator( class HuaweiSolarEntity(Entity): """Huawei Solar Entity.""" - _attr_has_entity_name = True - - def add_name_suffix(self, suffix) -> None: - """Add a suffix after the current entity name.""" - self._attr_name = f"{self.name}{suffix}" + _attr_has_entity_name = True \ No newline at end of file diff --git a/number.py b/number.py index cb0b406..edae9d9 100644 --- a/number.py +++ b/number.py @@ -141,10 +141,6 @@ async def async_setup_entry( DATA_CONFIGURATION_UPDATE_COORDINATORS ] # type: list[HuaweiSolarConfigurationUpdateCoordinator] - # When more than one inverter is present, then we suffix all sensors with '#1', '#2', ... - # The order for these suffixes is the order in which the user entered the slave-ids. - must_append_inverter_suffix = len(update_coordinators) > 1 - entities_to_add: list[NumberEntity] = [] for idx, (update_coordinator, configuration_update_coordinator) in enumerate( zip(update_coordinators, configuration_update_coordinators) @@ -183,11 +179,6 @@ async def async_setup_entry( bridge.slave_id, ) - # Add suffix if multiple inverters are present - if must_append_inverter_suffix: - for entity in slave_entities: - entity.add_name_suffix(f" #{idx+1}") - entities_to_add.extend(slave_entities) async_add_entities(entities_to_add) diff --git a/select.py b/select.py index ba33af2..88587a1 100644 --- a/select.py +++ b/select.py @@ -84,10 +84,6 @@ async def async_setup_entry( HuaweiSolarConfigurationUpdateCoordinator ] = hass.data[DOMAIN][entry.entry_id][DATA_CONFIGURATION_UPDATE_COORDINATORS] - # When more than one inverter is present, then we suffix all sensors with '#1', '#2', ... - # The order for these suffixes is the order in which the user entered the slave-ids. - must_append_inverter_suffix = len(update_coordinators) > 1 - entities_to_add: list[SelectEntity] = [] for idx, (update_coordinator, configuration_update_coordinator) in enumerate( zip(update_coordinators, configuration_update_coordinators) @@ -134,11 +130,6 @@ async def async_setup_entry( bridge.slave_id, ) - # Add suffix if multiple inverters are present - if must_append_inverter_suffix: - for entity in slave_entities: - entity.add_name_suffix(f" #{idx+1}") - entities_to_add.extend(slave_entities) async_add_entities(entities_to_add) diff --git a/sensor.py b/sensor.py index 1585fb2..cce5fef 100644 --- a/sensor.py +++ b/sensor.py @@ -632,10 +632,6 @@ async def async_setup_entry( DATA_CONFIGURATION_UPDATE_COORDINATORS ] # type: list[HuaweiSolarConfigurationUpdateCoordinator] - # When more than one inverter is present, then we suffix all sensors with '#1', '#2', ... - # The order for these suffixes is the order in which the user entered the slave-ids. - must_append_inverter_suffix = len(update_coordinators) > 1 - entities_to_add: list[SensorEntity] = [] for idx, (update_coordinator, configuration_update_coordinator) in enumerate( zip_longest(update_coordinators, configuration_update_coordinators) @@ -729,11 +725,6 @@ async def async_setup_entry( ) ) - # Add suffix if multiple inverters are present - if must_append_inverter_suffix: - for entity in slave_entities: - entity.add_name_suffix(f" #{idx+1}") - entities_to_add.extend(slave_entities) optimizer_update_coordinators = hass.data[DOMAIN][entry.entry_id][ diff --git a/switch.py b/switch.py index ac9ebce..d496a30 100644 --- a/switch.py +++ b/switch.py @@ -75,11 +75,7 @@ async def async_setup_entry( configuration_update_coordinators = hass.data[DOMAIN][entry.entry_id][ DATA_CONFIGURATION_UPDATE_COORDINATORS ] # type: list[HuaweiSolarConfigurationUpdateCoordinator] - - # When more than one inverter is present, then we suffix all sensors with '#1', '#2', ... - # The order for these suffixes is the order in which the user entered the slave-ids. - must_append_inverter_suffix = len(update_coordinators) > 1 - + entities_to_add: list[SwitchEntity] = [] for idx, (update_coordinator, configuration_update_coordinator) in enumerate( zip(update_coordinators, configuration_update_coordinators) @@ -115,11 +111,6 @@ async def async_setup_entry( bridge.slave_id, ) - # Add suffix if multiple inverters are present - if must_append_inverter_suffix: - for entity in slave_entities: - entity.add_name_suffix(f" #{idx+1}") - entities_to_add.extend(slave_entities) async_add_entities(entities_to_add)