diff --git a/homeassistant/components/bosch_shc/strings.json b/homeassistant/components/bosch_shc/strings.json index 1cc1069f2c24..d2359625d613 100644 --- a/homeassistant/components/bosch_shc/strings.json +++ b/homeassistant/components/bosch_shc/strings.json @@ -71,7 +71,7 @@ "name": "Child lock" }, "routing": { - "name": "Routing" + "name": "Range extension" } } } diff --git a/tests/components/bosch_shc/conftest.py b/tests/components/bosch_shc/conftest.py index c8cf981a38dd..7b282a71a86b 100644 --- a/tests/components/bosch_shc/conftest.py +++ b/tests/components/bosch_shc/conftest.py @@ -8,12 +8,14 @@ from unittest.mock import MagicMock, create_autospec, patch from boschshcpy import ( BatteryLevelService, PowerSwitchService, + RoutingService, SHCBatteryDevice, SHCLightSwitchBSM, SHCMicromoduleBlinds, SHCMicromoduleRelay, SHCPresenceSimulationSystem, SHCShutterControl, + SHCSmartPlug, SHCThermostat, ShutterControlService, ThermostatService, @@ -191,6 +193,27 @@ def micromodule_blinds_device( return device +def smart_plug_device( + device_id: str = "hdm:ZigBee:plug1", + name: str = "Smart Plug", + routing: RoutingService.State = RoutingService.State.DISABLED, +) -> SHCSmartPlug: + """Build a minimal device double for the smart_plugs bucket.""" + device = create_autospec(SHCSmartPlug, instance=True, spec_set=True) + device.name = name + device.id = device_id + device.root_device_id = "test-mac" + device.serial = f"serial-{device_id}" + device.manufacturer = "Bosch" + device.device_model = "PSM" + device.device_services = [] + device.deleted = False + device.status = "AVAILABLE" + device.switchstate = PowerSwitchService.State.OFF + device.routing = routing + return device + + def thermostat_device( device_id: str = "hdm:ZigBee:thermostat1", name: str = "Thermostat", diff --git a/tests/components/bosch_shc/test_switch.py b/tests/components/bosch_shc/test_switch.py index 4955107cc7b4..2a181a409acd 100644 --- a/tests/components/bosch_shc/test_switch.py +++ b/tests/components/bosch_shc/test_switch.py @@ -21,6 +21,7 @@ from .conftest import ( micromodule_relay_device, presence_simulation_system_device, setup_integration, + smart_plug_device, thermostat_device, ) @@ -193,3 +194,24 @@ async def test_no_presence_simulation_system( await setup_integration(hass, mock_config_entry) assert hass.states.get("switch.presence_simulation") is None + + +@pytest.mark.parametrize( + "device_buckets", + [{"smart_plugs": [smart_plug_device()]}], + indirect=True, +) +@pytest.mark.usefixtures("mock_session") +async def test_smart_plug_routing_switch_name( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + mock_config_entry: MockConfigEntry, +) -> None: + """The Smart Plug's routing switch is named "Range extension", not "Routing".""" + await setup_integration(hass, mock_config_entry) + + entry = entity_registry.async_get("switch.smart_plug_range_extension") + assert entry is not None + state = hass.states.get("switch.smart_plug_range_extension") + assert state is not None + assert state.attributes["friendly_name"] == "Smart Plug Range extension"