Hi everyone,
I remember reading a thread that mentioned the same idea, but I can’t find it. Except for the Gladys thread that provides the calculations: Faire une opération mathématique sur une “variable de scène” - #69 par pierre-gilles
Context
Every day, I calculate the consumption of my homelab and how much it costs me.
Every day at midnight, a scene retrieves the number of Wh consumed 24 hours ago, calculates the difference with now and multiplies it by the price per Wh from my energy provider.
- Current consumption (Wh) - Yesterday’s consumption (Wh) = Consumed in 24h
- Price per kWh * consumed in 24h = Cost of my lab over 24h
Here’s what it looks like:
Request
The electricity price is $0.06704 per kWh (I’m in Canada). So calculating 1.52 kWh * $0.06704 = $0.1019008.
In practice, I would be interested in having only the rounded value, i.e. $0.10.
I know the library used by Gladys is Mathjs, and that there is the round() function for that. But I can’t get it to work.
@bertrandda if you pass by, I’d appreciate your expertise on this integration ![]()





