I suggest using a Arduino with two hardware serial ports (such as the Arduino MEGA). Doing so, leaves the port for the USB communication available (for programming and serial monitor) while also dedicating another serial port for the RS-485.
I suggest using the smarmengol library as it offers slave and master programming in a single library.
YOU will need to find out what MODBUS commands are required in order to activate the relays. The address is given by the DIP switch, but that does not explain what commands are needed.