@@ -159,10 +159,8 @@ async def readFollowUp(old_data: Any, new_data: Any) -> bool:
159159 dev_registry .async_update_device (device .id , sw_version = sw_version , hw_version = hw_version )
160160 return True
161161
162+ # Entity names never carry the inverter suffix — the device name provides that context.
162163 inverter_name_suffix = ""
163- # Test: Comment out to prevent adding inverter suffix to Energy Dashboard sensors
164- # if hub.inverterNameSuffix is not None and hub.inverterNameSuffix != "":
165- # inverter_name_suffix = hub.inverterNameSuffix + " "
166164
167165 # Check if hub initialization is complete
168166 if hub .device_info is None :
@@ -228,17 +226,16 @@ async def readFollowUp(old_data: Any, new_data: Any) -> bool:
228226 if batt_pack_serial is None :
229227 continue
230228
229+ # Battery pack device name = hub name + pack identity (unique per config entry);
230+ # entity names never repeat it, HA composes the friendly name.
231231 device_info_battery = DeviceInfo (
232232 identifiers = cast (set [tuple [str , str ]], {(DOMAIN , hub_name , batt_pack_id )}),
233- name = hub . plugin . plugin_name + f" Battery { batt_nr + 1 } /{ batt_pack_nr + 1 } " ,
233+ name = f" { hub_name } Battery { batt_nr + 1 } /{ batt_pack_nr + 1 } " ,
234234 manufacturer = hub .plugin .plugin_manufacturer ,
235235 serial_number = batt_pack_serial ,
236236 via_device = cast (tuple [str , str ], (DOMAIN , hub_name , INVERTER_IDENT )),
237237 )
238238
239- name_prefix = battery_config .battery_sensor_name_prefix .replace ("{batt-nr}" , str (batt_nr + 1 )).replace (
240- "{pack-nr}" , str (batt_pack_nr + 1 )
241- )
242239 key_prefix = battery_config .battery_sensor_key_prefix .replace ("{batt-nr}" , str (batt_nr + 1 )).replace (
243240 "{pack-nr}" , str (batt_pack_nr + 1 )
244241 )
@@ -275,7 +272,7 @@ async def readFollowUpBattery(
275272 computedRegs ,
276273 device_info_battery ,
277274 battery_config .battery_sensor_type ,
278- name_prefix ,
275+ "" , # entity names never carry the pack prefix — the battery device name provides it
279276 key_prefix ,
280277 readPreparation ,
281278 readFollowUpBattery ,
@@ -553,6 +550,8 @@ async def async_refresh_energy_dashboard_entities() -> None:
553550class SolaXModbusSensor (SensorEntity ):
554551 """Representation of an SolaX Modbus sensor."""
555552
553+ _attr_has_entity_name = True
554+
556555 def __init__ (
557556 self ,
558557 platform_name : str ,
@@ -617,10 +616,8 @@ def _update_state(self) -> None: # never called ?????
617616
618617 @property
619618 def name (self ) -> str :
620- """Return the name."""
621- if self .entity_description .key in COMMUNICATION_SENSOR_KEYS :
622- return str (self .entity_description .name or self .entity_description .key )
623- return f"{ self ._platform_name } { self .entity_description .name } "
619+ """Return the entity name (description name only — the device name provides context)."""
620+ return str (self .entity_description .name or self .entity_description .key )
624621
625622 @property
626623 def unique_id (self ) -> str | None :
0 commit comments