Custom formula in text/value widget

I have one value, which describes current battery percentage. I want to be able to show value which will say for how long device can run with this battery percentage. So I need to be able to some function over data time series. Like:

battery_days_left = battery_percentage / (max(battery_percentage, 24h) - min(battery_percentage, 24h))

How can I implement such custom formula in any widget?

Thanks for help.

It is not possible (yet, and I don’t know if they are going to do it) to run custom scripts on server side.

I recommend you to do the math at microcontroler and upload the value as another variable

Hope this helps

Thank you. Unfortunately my device is not storing data locally and sending them on runtime. This feature would be great to have to be honest. At least max, min and count values.

Oh I see… But if you are measuring how many days the device runs… Why dont do it with battery voltage? I think thats a good indicator of battery charge.

Hope this helps