I checked, running the tmSensor driver in addition does not change anything. What helps is adding at the end of the script that the command should be sent several times. Although this is not a very elegant solution.
.
...
refresh:
// channel 5 is temporary variable, from 0 to 255*3, multiplied also by toggle value
setChannel 5 $CH2*3*$CH1
// split into two bytes
setChannel 3 $CH5/256
setChannel 4 $CH5%256
// send the two bytes
tuyaMcu_sendCmd 0x30 00$CH3$$CH4$
delay_ms 3
tuyaMcu_sendCmd 0x30 00$CH3$$CH4$
delay_ms 3
tuyaMcu_sendCmd 0x30 00$CH3$$CH4$