diff --git a/homeassistant/components/husqvarna_automower/select.py b/homeassistant/components/husqvarna_automower/select.py index 9124a0705e1..1dde9e16295 100644 --- a/homeassistant/components/husqvarna_automower/select.py +++ b/homeassistant/components/husqvarna_automower/select.py @@ -19,10 +19,10 @@ _LOGGER = logging.getLogger(__name__) PARALLEL_UPDATES = 1 HEADLIGHT_MODES: list = [ - HeadlightModes.ALWAYS_OFF.lower(), - HeadlightModes.ALWAYS_ON.lower(), - HeadlightModes.EVENING_AND_NIGHT.lower(), - HeadlightModes.EVENING_ONLY.lower(), + HeadlightModes.ALWAYS_OFF, + HeadlightModes.ALWAYS_ON, + HeadlightModes.EVENING_AND_NIGHT, + HeadlightModes.EVENING_ONLY, ] @@ -65,13 +65,11 @@ class AutomowerSelectEntity(AutomowerControlEntity, SelectEntity): @property def current_option(self) -> str: """Return the current option for the entity.""" - return cast( - HeadlightModes, self.mower_attributes.settings.headlight.mode - ).lower() + return cast(HeadlightModes, self.mower_attributes.settings.headlight.mode) @handle_sending_exception() async def async_select_option(self, option: str) -> None: """Change the selected option.""" await self.coordinator.api.commands.set_headlight_mode( - self.mower_id, cast(HeadlightModes, option.upper()) + self.mower_id, HeadlightModes(option) ) diff --git a/tests/components/husqvarna_automower/test_select.py b/tests/components/husqvarna_automower/test_select.py index 01e7607735b..f1b855a90a3 100644 --- a/tests/components/husqvarna_automower/test_select.py +++ b/tests/components/husqvarna_automower/test_select.py @@ -74,7 +74,7 @@ async def test_select_commands( blocking=True, ) mocked_method = mock_automower_client.commands.set_headlight_mode - mocked_method.assert_called_once_with(TEST_MOWER_ID, service.upper()) + mocked_method.assert_called_once_with(TEST_MOWER_ID, service) assert len(mocked_method.mock_calls) == 1 mocked_method.side_effect = ApiError("Test error")