This will be easier to accomplish when we’ve updated the triggers engine to allow things like executing custom code, multiple conditional statements, etc. But in the meantime I have an idea: Is your project with Arduino or Raspberry Pi? If you’re using Arduino, you could do the calculation in your sketch code, then pass the result that the trigger engine would need to care about to a virtual pin, then you could have Cayenne trigger based off of that result.
I can help you with the code if you let me know what the sketch file you’re currently using looks like.