Hi Liquidbeam,
I know it has been a long time since you posted this, and I am curious if you ever got it to work. While I have worked with M5Stack (Blockly) for years. I know I can help you with the other aspects of your desired application and am more than willing to assist. This however is my first experience with BLE device scanning.
I copied your code into my CoreS3 with UIFLOW2 V2.2.4, and I can't even replicate what you have done.
I would very much appreciate an update on your experience.
Thank you
Bruce Kusens