Which capabilities are required, which are usable and which don't do anything?

I’m trying to re-use my existing desktop test code to also work on mobile.
(Windows x64 machine)
I use a selenium grid with selenium-standalone-server version 3.6.0
I’m using ruby 2.3.3 (32 bit) with Watir 6.8.4, selenium-webdriver 3.6.0 and lapis_lazuli 2.0.0 (so no appium_lib)
I’m using Appium desktop application v1.2.5 with appium server v1.7.1

I run the selenium-grid hub and the appium server both on my localhost and this is my appium-node-config.json

{
  "capabilities":[
    {
	"platform": "ANDROID",
	"platformName": "Android",
	"platformVersion": "7.1.1",
	"browserName": "chrome",
	"version": "9",
	"deviceName": "Nexus 9",
	"udid": "192.1.1.55:5555",
    "maxInstances": 1,
	"newCommandTimeout": "300"
    }, ....

In my env.rb file I have this (which does the same as Watir::Browser.New since lapis_lazuli is just a wrapper around Watir to make life easier):

browser :chrome, {
	url: "http://localhost:4444/wd/hub",  
	browserName: "chrome",
	version: "9",
	platformName: "Android",
	platformVersion: "7.1.1",
	deviceName: "Nexus 9",
	udid: "192.1.1.55:5555",
	read_timeout: 180,
	javascript_enabled: true,
	unicodeKeyboard: true, 
	resetKeyboard: true
} 

I noticed that if I leave out the version or udid it starts to screw things up for me.
To clearify this a bit, it will occupy the wrong machine on the grid, but execute the test on the correct device, or the other way around. I have 2 devices that are having the same Android version. So that is not unique enought for the selection and just the deviceName does not seem to do enough either (hence my search for additional capabilities I could use to solve this issue).
This brings me to the questions:

  • Which capabilities are mandatory on the appium side? (and which are handy/optional)
  • Which capabilities are mandatory on the ruby env.rb file side? (same sub Q)
  • Is the messed up session (when I leave out version or udid) because of me using watir/selenium instead of appium_lib?
  • Is there anything wrong about my approach or was this never meant to work and I just got lucky I got this far (and should I switch to appium_lib)? (I just would like to reuse tests I wrote as much as possible)

To clearify that I see going wrong is this (it’s a bit of an older log file, I tried many conbinations, but always when I leave out version or udid (or both) this is what happens).

Incomming session request (so far so good)
15:42:33.839 INFO - Got a request to create a new session: Capabilities [{rotatable=false, version=, deviceName=Nexus9, platform=ANY, nativeEvents=false, platformVersion=7.1.1, browserName=chrome, takesScreenshot=false, javascriptEnabled=true, unicodeKeyboard=true, platformName=ANY, cssSelectorsEnabled=true, resetKeyboard=true}]

But then Selenium grid says it will try to start a different session (not sure if it gets this info back from appium or it’s a selenium issue?):
15:42:33.840 INFO - Trying to create a new session on test slot {newCommandTimeout=300, platformVersion=6.0.1, browserName=chrome, platformName=Android, maxInstances=1, version=6.0.1, deviceName=Nexus5, platform=ANDROID}

Meaning the one it says it will start is being occupied in the grid.
BUT Appium actually starts the session with the one we requested initially.

This is what I figured out myself in the meantime.