Hi @Thomas Lund, welcome to the Sonos Community!
When connecting a Sonos device via optical (e.g. the Ray, Playbar, or a soundbar using the optical adaptor), then your remote must be infrared (IR) and other options such as radio frequency (RF) or Bluetooth wont work.
I’ve seen that some Samsung remotes have the option to enable IR in the settings. Since it’ll likely be different for each remote, check your TV remote manual or Samsung’s support site for more information. Once the remote is working with IR, you can perform the Remote Control Setup in the Sonos app to get it working with your Playbar.
I hope this helps!