Calculation in Gladys

Hello,

I would like to add two values (HP index + HC index) in Gladys but I can’t manage it.

As far as I remember, in scenes you could perform simple operations on variables using the ‹ control a device › block.

But in the list of devices offered, I only have switches or images:

Is this a regression, or am I mistaken or doing something wrong?

Thanks for your help!

Edit: I’m not crazy, I did see that somewhere: Fonctions mathématiques disponibles | Gladys Assistant

Currently, the scene action « Control a device » only shows the « actuators », not the sensors that are « read-only ». In itself, we could change that :slightly_smiling_face:

In the meantime, you can use the « Send an MQTT message » block to do the same:

![Screenshot 2025-12-13 at 10.02.05|427x500](upload://5Ga1qwV

Because I can’t get the energy monitoring integration to work as it stands. I don’t know, when prioritizing, whether I should put the outlets on the peak hours index or the off-peak hours index. I was therefore thinking of putting them on a global index whose value corresponded to the sum of the two other indexes…

Ok, that makes sense, but in this case, for now it’s not being used, so it doesn’t matter ^^

1 Like

Well, anyway, I can’t get it to work… Mathematical operations don’t seem to work (a simple +1000 or *1000). Because of the float?

What exactly do you need to distinguish?
If it’s costs, the monitoring handles the different tariffs so I don’t think it’s necessary.
Is it a breakdown of your off-peak and peak hours across your sockets?

On my side, I have the main electricity meter (created by Gladys) (N0)
Then my 6 indexes for Tempo as children (N-1).
My sockets and other devices are also at N-1, at the same level as the Tempo indexes because it’s not possible to put them under my different Tempo indexes.

@pierre-gilles, will your kWh monitoring show different colors for off-peak/peak hours for a socket, for example?

Not currently, but that’s the idea for later!

1 Like