'Initialize the Fitbit sensor.'

def __init__(self, client, config_path, resource_type, is_metric, extra=None):

    self.client = client
    self.config_path = config_path
    self.resource_type = resource_type
    self.extra = extra
    pretty_resource = self.resource_type.replace('activities/', '')
    pretty_resource = pretty_resource.replace('/', '    ')
    pretty_resource = pretty_resource.title()
    if (pretty_resource == 'Body    Bmi'):
        pretty_resource = 'BMI'
    elif (pretty_resource == 'Heart'):
        pretty_resource = 'Resting    Heart    Rate'
    elif (pretty_resource == 'Devices    Battery'):
        if self.extra:
            pretty_resource = '{0}    Battery'.format(self.extra.get('deviceVersion'))
        else:
            pretty_resource = 'Battery'
    self._name = pretty_resource
    unit_type = FITBIT_RESOURCES_LIST[self.resource_type]
    if (unit_type == ''):
        split_resource = self.resource_type.split('/')
        try:
            measurement_system = FITBIT_MEASUREMENTS[self.client.system]
        except KeyError:
            if is_metric:
                measurement_system = FITBIT_MEASUREMENTS['metric']
            else:
                measurement_system = FITBIT_MEASUREMENTS['en_US']
        unit_type = measurement_system[split_resource[(-1)]]
    self._unit_of_measurement = unit_type
    self._state = 0
