Yes, if the device box is metal it must be grounded by code. This is done for safety reasons to ensure a proper path for a ground fault to follow.