diff --git a/homeassistant/components/husqvarna_automower/binary_sensor.py b/homeassistant/components/husqvarna_automower/binary_sensor.py index 922f7deb99b6f..5d1ccb6a07495 100644 --- a/homeassistant/components/husqvarna_automower/binary_sensor.py +++ b/homeassistant/components/husqvarna_automower/binary_sensor.py @@ -28,7 +28,7 @@ class AutomowerBinarySensorEntityDescription(BinarySensorEntityDescription): value_fn: Callable[[MowerAttributes], bool] -BINARY_SENSOR_TYPES: tuple[AutomowerBinarySensorEntityDescription, ...] = ( +MOWER_BINARY_SENSOR_TYPES: tuple[AutomowerBinarySensorEntityDescription, ...] = ( AutomowerBinarySensorEntityDescription( key="battery_charging", value_fn=lambda data: data.mower.activity == MowerActivities.CHARGING, @@ -57,7 +57,7 @@ async def async_setup_entry( async_add_entities( AutomowerBinarySensorEntity(mower_id, coordinator, description) for mower_id in coordinator.data - for description in BINARY_SENSOR_TYPES + for description in MOWER_BINARY_SENSOR_TYPES ) diff --git a/homeassistant/components/husqvarna_automower/button.py b/homeassistant/components/husqvarna_automower/button.py index 696c5ae85ea6d..bbc6316c54150 100644 --- a/homeassistant/components/husqvarna_automower/button.py +++ b/homeassistant/components/husqvarna_automower/button.py @@ -46,7 +46,7 @@ class AutomowerButtonEntityDescription(ButtonEntityDescription): press_fn: Callable[[AutomowerSession, str], Awaitable[Any]] -BUTTON_TYPES: tuple[AutomowerButtonEntityDescription, ...] = ( +MOWER_BUTTON_TYPES: tuple[AutomowerButtonEntityDescription, ...] = ( AutomowerButtonEntityDescription( key="confirm_error", translation_key="confirm_error", @@ -73,7 +73,7 @@ async def async_setup_entry( async_add_entities( AutomowerButtonEntity(mower_id, coordinator, description) for mower_id in coordinator.data - for description in BUTTON_TYPES + for description in MOWER_BUTTON_TYPES if description.exists_fn(coordinator.data[mower_id]) ) diff --git a/homeassistant/components/husqvarna_automower/number.py b/homeassistant/components/husqvarna_automower/number.py index c22bb4d37f7ca..2a67400d1bf5a 100644 --- a/homeassistant/components/husqvarna_automower/number.py +++ b/homeassistant/components/husqvarna_automower/number.py @@ -65,7 +65,7 @@ class AutomowerNumberEntityDescription(NumberEntityDescription): set_value_fn: Callable[[AutomowerSession, str, float], Awaitable[Any]] -NUMBER_TYPES: tuple[AutomowerNumberEntityDescription, ...] = ( +MOWER_NUMBER_TYPES: tuple[AutomowerNumberEntityDescription, ...] = ( AutomowerNumberEntityDescription( key="cutting_height", translation_key="cutting_height", @@ -81,7 +81,7 @@ class AutomowerNumberEntityDescription(NumberEntityDescription): @dataclass(frozen=True, kw_only=True) -class AutomowerWorkAreaNumberEntityDescription(NumberEntityDescription): +class WorkAreaNumberEntityDescription(NumberEntityDescription): """Describes Automower work area number entity.""" value_fn: Callable[[WorkArea], int] @@ -91,8 +91,8 @@ class AutomowerWorkAreaNumberEntityDescription(NumberEntityDescription): ] -WORK_AREA_NUMBER_TYPES: tuple[AutomowerWorkAreaNumberEntityDescription, ...] = ( - AutomowerWorkAreaNumberEntityDescription( +WORK_AREA_NUMBER_TYPES: tuple[WorkAreaNumberEntityDescription, ...] = ( + WorkAreaNumberEntityDescription( key="cutting_height_work_area", translation_key_fn=_work_area_translation_key, entity_category=EntityCategory.CONFIG, @@ -117,7 +117,7 @@ async def async_setup_entry( _work_areas = coordinator.data[mower_id].work_areas if _work_areas is not None: entities.extend( - AutomowerWorkAreaNumberEntity( + WorkAreaNumberEntity( mower_id, coordinator, description, work_area_id ) for description in WORK_AREA_NUMBER_TYPES @@ -126,7 +126,7 @@ async def async_setup_entry( async_remove_work_area_entities(hass, coordinator, entry, mower_id) entities.extend( AutomowerNumberEntity(mower_id, coordinator, description) - for description in NUMBER_TYPES + for description in MOWER_NUMBER_TYPES if description.exists_fn(coordinator.data[mower_id]) ) async_add_entities(entities) @@ -161,16 +161,16 @@ async def async_set_native_value(self, value: float) -> None: ) -class AutomowerWorkAreaNumberEntity(WorkAreaControlEntity, NumberEntity): - """Defining the AutomowerWorkAreaNumberEntity with AutomowerWorkAreaNumberEntityDescription.""" +class WorkAreaNumberEntity(WorkAreaControlEntity, NumberEntity): + """Defining the WorkAreaNumberEntity with WorkAreaNumberEntityDescription.""" - entity_description: AutomowerWorkAreaNumberEntityDescription + entity_description: WorkAreaNumberEntityDescription def __init__( self, mower_id: str, coordinator: AutomowerDataUpdateCoordinator, - description: AutomowerWorkAreaNumberEntityDescription, + description: WorkAreaNumberEntityDescription, work_area_id: int, ) -> None: """Set up AutomowerNumberEntity.""" diff --git a/homeassistant/components/husqvarna_automower/switch.py b/homeassistant/components/husqvarna_automower/switch.py index 1808b651d3dfc..c26348d875a23 100644 --- a/homeassistant/components/husqvarna_automower/switch.py +++ b/homeassistant/components/husqvarna_automower/switch.py @@ -40,9 +40,7 @@ async def async_setup_entry( _stay_out_zones = coordinator.data[mower_id].stay_out_zones if _stay_out_zones is not None: entities.extend( - AutomowerStayOutZoneSwitchEntity( - coordinator, mower_id, stay_out_zone_uid - ) + StayOutZoneSwitchEntity(coordinator, mower_id, stay_out_zone_uid) for stay_out_zone_uid in _stay_out_zones.zones ) async_remove_entities(hass, coordinator, entry, mower_id) @@ -86,7 +84,7 @@ async def async_turn_on(self, **kwargs: Any) -> None: await self.coordinator.api.commands.resume_schedule(self.mower_id) -class AutomowerStayOutZoneSwitchEntity(AutomowerControlEntity, SwitchEntity): +class StayOutZoneSwitchEntity(AutomowerControlEntity, SwitchEntity): """Defining the Automower stay out zone switch.""" _attr_translation_key = "stay_out_zones"