def METHOD_NAME(self, component_config: Union[Dict, LgBatSetup, LgCounterSetup, LgInverterSetup]) -> None:
    if isinstance(component_config, Dict):
        component_type = component_config["type"]
    else:
        component_type = component_config.type
    component_config = dataclass_from_dict(COMPONENT_TYPE_TO_MODULE[
        component_type].component_descriptor.configuration_factory, component_config)
    if component_type in self.COMPONENT_TYPE_TO_CLASS:
        self.components["component"+str(component_config.id)] = (self.COMPONENT_TYPE_TO_CLASS[component_type](
            self.device_config.id,
            component_config))
    else:
        raise Exception(
            "illegal component type " + component_type + ". Allowed values: " +
            ','.join(self.COMPONENT_TYPE_TO_CLASS.keys())
        )