Wrong trigger codes from PsychoPy to brainvision

PsychoPy version: 2020.1.3

I’m working hard to get PsychoPy to send triggers to Brainvision recorder via serial port, and so far I’m having success with sending trigger codes below 10 - they show up when they should, and they are correctly labeled in the Recorder software. However, I’m trying to add more triggers, and if I add e.g. 11, it will show up as S1 in recorder - which is of course the same as for trigger code 1. If I write e.g. 222, it shows up as S2. I tried putting the code in brackets ([222]), but then it seems to send R3+S13 no matter what numbers I have in the brackets. So I’m confused as to how I can include trigger codes higher than 9. Any tips?

Here is my code:
In begin experiment:

import serial
s_port = serial.Serial()
s_port.port = COM3
s_port.timeout = 1

In Begin routine:

stimulus_pulse_started = False
stimulus_pulse_ended = False

In each frame:

if W1_2.status == True:
      win.callonFlip(s_port.write, str.encode('1')) #or str.encode([11]), or [222], or several other numbers I've tried
if W1_2.status == False:
      win.callonFlip(s_port.write, str.encode('0'))