Parallel execution with Selenium Grid

Hello.
I have a simple task.
I need to execute many different tests on two emulators.
So, i have: 1 PC, 2 Android emulators (emulator-5554 and emulator-5556), Selenium grid and two instances of Appium.
I understand, that i need somhow to link every Appium to different emulator.
I tried many capabilities in default config, but still it launched at emulator-5554
{
“capabilities”:
[
{
“browserName”: “android”,
“platformVersion”:“7.0”,
“maxInstances”: 1,
“platformName”:“android”,
“version”:“DEFAULT”,
“deviceName”:“emulator-5556”,
“deviceUDID”:“emulator-5556”,
“udid”:“emulator-5556”,
“avd”:“emulator-5556”
}
],
“configuration”:
{
“cleanUpCycle”:3000,
“timeout”:30000,
“url”:“http://***:4626/wd/hub”,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“host”: “test-mobile1”,
“port”: 4626,
“maxSession”: 1,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “***”
}
}

I cant set UDID in desired capabilities, because i dont know which emulator/appium is free right in a moment.
I read, that many versions ago, i could launch appium server from command line with udid parameter. But i use latest version and dont understand how to do it now.