OH2 and Arduino MEGA over USB

hello,

I start with OH2 and I have a question. What is preferred connection to Arduino MEGA in OH2

Regards,
Sew

To what? Your openHAB machine? What is it?
Is it a mega on it’s own or do your have an Ethernet shield?

I want to connect MEGA to OpenHab. I don’t have Ethernet shield

On what machine does openHAB run? Raspberry PI, UNIX mainframe server, laptop, NAS?
The way to connect will depend on the hardware mostly, not openHAB.

Connecting is normally done with wires which is hardware
openHAB is software

The OpenHab is installed on Raspberry PI

OK, now we are getting somewhere.
You have choices.

You can connect the MEGA to the Pi via the USB port on each device. That means that you’ll have to power the mega via the barrel plug. The protocol will be serial.
You can also use the serial pins on each device and communicate with the serial protocol

I plan to use Arduino Yun in the future in other building. No I have only Arduino MEGA. What is better MQTT or serial?

To use MQTT your device needs to be connected to an IP network.
MQTT definitely.

I should use MySensors or is another way?

WOW, slow down… Here…
What do you want to do?

I want to control the lighting (switch) and temperature (sensors)

You want to control switches and read temperature sensors.
What switches and sensors do you want to use?