Repository: home-assistant/core
File: homeassistant/components/renault/button.py (Python)

Code before:
) -> None:
    """Set up the Renault entities from config entry."""
    entities: list[RenaultButtonEntity] = [
        RenaultButtonEntity(vehicle, description)
        for vehicle in config_entry.runtime_data.vehicles.values()
        for description in BUTTON_TYPES
        if description.is_supported(vehicle)
    ]
    async_add_entities(entities)


class RenaultButtonEntity(RenaultEntity, ButtonEntity):
    """Mixin for button specific attributes."""

    entity_description: RenaultButtonEntityDescription

    async def async_press(self) -> None:
        """Process the button press."""
        await self.entity_description.async_press(self)


BUTTON_TYPES: tuple[RenaultButtonEntityDescription, ...] = (
    RenaultButtonEntityDescription(
        async_press=lambda x: x.vehicle.set_ac_start(21, None),
        key="start_air_conditioner",
        is_supported=lambda vehicle: vehicle.details.supports_endpoint("actions/hvac-start"),
        translation_key="start_air_conditioner",
    ),
    RenaultButtonEntityDescription(
        async_press=lambda x: x.vehicle.set_charge_start(),
        key="start_charge",
        is_supported=lambda vehicle: vehicle.details.uses_electricity(),
        translation_key="start_charge",
    ),
    RenaultButtonEntityDescription(
        async_press=lambda x: x.vehicle.set_charge_stop(),
        key="stop_charge",
        is_supported=lambda vehicle: vehicle.details.uses_electricity(),
        translation_key="stop_charge",
    ),
    RenaultButtonEntityDescription(
        async_press=lambda x: x.vehicle.start_horn(),
        key="start_horn",
        is_supported=lambda vehicle: vehicle.details.supports_endpoint("actions/horn-start"),
        translation_key="start_horn",
    ),
    RenaultButtonEntityDescription(
        async_press=lambda x: x.vehicle.start_lights(),
        key="start_lights",
        is_supported=lambda vehicle: vehicle.details.supports_endpoint("actions/lights-start"),
        translation_key="start_lights",

Review comment (bug):
Incorrect format
```suggestion
        is_supported=lambda vehicle: (
            vehicle.details.supports_endpoint("actions/hvac-start")
        ),
```

Code after:
    async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
    """Set up the Renault entities from config entry."""
    entities: list[RenaultButtonEntity] = [
        RenaultButtonEntity(vehicle, description)
        for vehicle in config_entry.runtime_data.vehicles.values()
        for description in BUTTON_TYPES
        if description.is_supported(vehicle)
    ]
    async_add_entities(entities)


class RenaultButtonEntity(RenaultEntity, ButtonEntity):
    """Mixin for button specific attributes."""

    entity_description: RenaultButtonEntityDescription

    async def async_press(self) -> None:
        """Process the button press."""
        await self.entity_description.async_press(self)


BUTTON_TYPES: tuple[RenaultButtonEntityDescription, ...] = (
    RenaultButtonEntityDescription(
        async_press=lambda x: x.vehicle.set_ac_start(21, None),
        key="start_air_conditioner",
        is_supported=lambda vehicle: (
            vehicle.details.supports_endpoint("actions/hvac-start")
        ),
        translation_key="start_air_conditioner",
    ),
    RenaultButtonEntityDescription(
        async_press=lambda x: x.vehicle.set_charge_start(),
        key="start_charge",
        is_supported=lambda vehicle: (
            vehicle.details.supports_endpoint("actions/charge-start")
            and vehicle.details.uses_electricity()
        ),
        translation_key="start_charge",
    ),
    RenaultButtonEntityDescription(
        async_press=lambda x: x.vehicle.set_charge_stop(),
        key="stop_charge",
        is_supported=lambda vehicle: (
            vehicle.details.supports_endpoint("actions/charge-stop")
            and vehicle.details.uses_electricity()
        ),
        translation_key="stop_charge",
    ),
)