How do I convert a string into a "number"?

By the way, I’ve done something similar for Google Assistant and Xiaomi vacuums (through IFTTT) and in the end I went with writing a python script for some more flexibility.

Not saying you should but check here if you want some inspiration: