def METHOD_NAME(component_type: str,
                ip_address: str,
                ip2_address: Optional[str] = None,
                gateway: Optional[int] = None) -> None:
    if gateway is not None:
        if gateway == 0:
            energy_manager = True
        else:
            energy_manager = False
    else:
        energy_manager = False
    if component_type == "bat" or component_type == "counter":
        if energy_manager:
            ip = ip_address
        else:
            ip = ip2_address
        device = create_device(SolarWatt(configuration=SolarWattConfiguration(
            ip_address=ip, energy_manager=bool(energy_manager))))
        if component_type == "bat":
            device.add_component(SolarWattBatSetup(id=None))
        else:
            device.add_component(SolarWattCounterSetup(id=None))
    else:
        device = create_device(SolarWatt(configuration=SolarWattConfiguration(
            ip_address=ip_address, energy_manager=bool(energy_manager))))
        device.add_component(SolarWattInverterSetup(id=1))
    log.debug('SolarWatt ip_address: ' + ip_address + ', ip2_address: ' +
              str(ip2_address) + ", gateway: " + str(gateway))
    device.update()