Not really enough information here.
Which Sonos sound bar are you using? Using an optical connection limits your abilities, since optical is a one way transmission, and the Sonos can’t “register” itself with CEC running on the TV. It also requires that you change any remote control used for the TV set to be set to IR, and not any of the “smart” connection types, such as RF, or Bluetooth.
If I were to hazard a guess, you have a Sonos PLAYBAR connected by optical, which means you’ll need to look up in your Pioneer’s manual on how to switch the remote over to use IR instead of other methods of connection. Once you’ve done that, it’s fairly simple in the Sonos software to “teach” the Sonos to be able to recognize the IR codes being emitted by the remote.
I assume they mean Panasonic instead of Pioneer. That model is definitely a Panasonic TV.
Apologies, the frustration of not being able to get it to link obviously got to me, yes it is Panasonic.