I have solved it!!! The problem was in the function write, I was sending the headers in a write command and then, the at string in another one. I put the headers and the at command in only one byte array, used only a write and it’s working now!
The modified function:
def write(data):
size=len(data)
utime.sleep_ms(wait_delay)
arr = bytes([0x10,0x02,size >> 8,size & 0xFF]) + data
i2c.writeto(I2CADDRESS,arr)
utime.sleep_ms(wait_delay)