diff --git a/custom_components/mammotion/switch.py b/custom_components/mammotion/switch.py index e03f948..eef6ced 100644 --- a/custom_components/mammotion/switch.py +++ b/custom_components/mammotion/switch.py @@ -124,7 +124,7 @@ def add_entities() -> None: existing_name: AreaHashNameList | None = next( (area for area in area_name if str(area.hash) == str(area_id)), None ) - name = existing_name.name if existing_name else f"{area_id}" + name = existing_name.name if (existing_name and existing_name.name) else f"{area_id}" base_area_switch_entity = MammotionConfigAreaSwitchEntityDescription( key=f"{area_id}", translation_key="area",