Repository: home-assistant/core
File: homeassistant/components/unifi/sensor.py (Python)

Code before:
        entity_registry_enabled_default=False,
        state_class=SensorStateClass.MEASUREMENT,
        native_unit_of_measurement=UnitOfDataRate.BYTES_PER_SECOND,
        suggested_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND,
        allowed_fn=lambda hub, _: hub.config.option_allow_bandwidth_sensors,
        api_handler_fn=lambda api: api.ports,
        available_fn=async_device_available_fn,
        device_info_fn=async_device_device_info_fn,
        name_fn=lambda port: f"{port.name} TX",
        object_fn=lambda api, obj_id: api.ports[obj_id],
        unique_id_fn=lambda hub, obj_id: f"port_tx-{obj_id}",
        value_fn=lambda hub, port: port.tx_bytes_r,
    ),
    UnifiSensorEntityDescription[Ports, Port](
        key="Port speed",
        translation_key="port_link_speed",
        device_class=SensorDeviceClass.DATA_RATE,
        entity_category=EntityCategory.DIAGNOSTIC,
        state_class=SensorStateClass.MEASUREMENT,
        native_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND,
        suggested_display_precision=0,
        entity_registry_enabled_default=False,
        api_handler_fn=lambda api: api.ports,
        available_fn=async_device_available_fn,
        device_info_fn=async_device_device_info_fn,
        name_fn=lambda port: f"{port.name} Link speed",
        object_fn=lambda api, obj_id: api.ports[obj_id],
        supported_fn=lambda hub, obj_id: hub.api.ports[obj_id].raw.get("speed", 0) > 0,
        unique_id_fn=lambda hub, obj_id: f"port_link_speed-{obj_id}",
        value_fn=lambda hub, port: port.raw.get("speed"),
    ),
    UnifiSensorEntityDescription[Clients, Client](
        key="Client uptime",
        device_class=SensorDeviceClass.TIMESTAMP,
        entity_category=EntityCategory.DIAGNOSTIC,
        entity_registry_enabled_default=False,
        allowed_fn=async_uptime_sensor_allowed_fn,
        api_handler_fn=lambda api: api.clients,
        device_info_fn=async_client_device_info_fn,
        name_fn=lambda client: "Uptime",
        object_fn=lambda api, obj_id: api.clients[obj_id],
        supported_fn=lambda hub, _: hub.config.option_allow_uptime_sensors,
        unique_id_fn=lambda hub, obj_id: f"uptime-{obj_id}",
        value_fn=async_client_uptime_value_fn,
        value_changed_fn=async_uptime_value_changed_fn,
    ),
    UnifiSensorEntityDescription[Wlans, Wlan](
        key="WLAN clients",
        translation_key="wlan_clients",
        entity_category=EntityCategory.DIAGNOSTIC,
        state_class=SensorStateClass.MEASUREMENT,

Review comment (suggestion):
```suggestion
        name_fn=lambda port: f"{port.name} link speed",
```

Code after:
        entity_registry_enabled_default=False,
        state_class=SensorStateClass.MEASUREMENT,
        native_unit_of_measurement=UnitOfDataRate.BYTES_PER_SECOND,
        suggested_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND,
        allowed_fn=lambda hub, _: hub.config.option_allow_bandwidth_sensors,
        api_handler_fn=lambda api: api.ports,
        available_fn=async_device_available_fn,
        device_info_fn=async_device_device_info_fn,
        name_fn=lambda port: f"{port.name} TX",
        object_fn=lambda api, obj_id: api.ports[obj_id],
        unique_id_fn=lambda hub, obj_id: f"port_tx-{obj_id}",
        value_fn=lambda hub, port: port.tx_bytes_r,
    ),
    UnifiSensorEntityDescription[Ports, Port](
        key="Port speed",
        translation_key="port_link_speed",
        device_class=SensorDeviceClass.DATA_RATE,
        entity_category=EntityCategory.DIAGNOSTIC,
        native_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND,
        suggested_display_precision=0,
        entity_registry_enabled_default=False,
        api_handler_fn=lambda api: api.ports,
        available_fn=async_device_available_fn,
        device_info_fn=async_device_device_info_fn,
        name_fn=lambda port: f"{port.name} link speed",
        object_fn=lambda api, obj_id: api.ports[obj_id],
        supported_fn=lambda hub, obj_id: hub.api.ports[obj_id].raw.get("speed", 0) > 0,
        unique_id_fn=lambda hub, obj_id: f"port_link_speed-{obj_id}",
        value_fn=lambda hub, port: port.raw.get("speed", 0),
    ),
    UnifiSensorEntityDescription[Clients, Client](
        key="Client uptime",
        device_class=SensorDeviceClass.TIMESTAMP,
        entity_category=EntityCategory.DIAGNOSTIC,
        entity_registry_enabled_default=False,
        allowed_fn=async_uptime_sensor_allowed_fn,
        api_handler_fn=lambda api: api.clients,
        device_info_fn=async_client_device_info_fn,
        name_fn=lambda client: "Uptime",
        object_fn=lambda api, obj_id: api.clients[obj_id],
        supported_fn=lambda hub, _: hub.config.option_allow_uptime_sensors,
        unique_id_fn=lambda hub, obj_id: f"uptime-{obj_id}",
        value_fn=async_client_uptime_value_fn,
        value_changed_fn=async_uptime_value_changed_fn,
    ),
    UnifiSensorEntityDescription[Wlans, Wlan](
        key="WLAN clients",
        translation_key="wlan_clients",
        entity_category=EntityCategory.DIAGNOSTIC,
        state_class=SensorStateClass.MEASUREMENT,
        api_handler_fn=lambda api: api.wlans,