Math with variables?

Addition of variables is great! I know they are new, so this might be asking too much. I have two humidity sensors and I’d like to report the average of the two relative humidity values on my dashboard. I see where I can a variable equal to a sensors RH value. Is there anyway, for example, to set a variable equal to (RH1+RH2)/2, where RH1 and RH2 are the humidity values reported by the two sensors?

1 Like

@kbhousen , simple math is in my hit list so it’s great to see some use cases. Thanks for the suggestion.:+1:


I have some battery sensors that report in mV, so like 12,440mV. Haveing some math would be good so I can convert to display in volts, like 12.4v. I voted yes.


Another use of math in variables would be to raise/lower intensity level of bulbs.

Example: successive presses of a “Dim” switch would reduce the level by 10,


Upvoting this per my thread in the Beta forum:

I would have upvoted this but it’s apparently maxed out. My math wish is for ‘if current value is less than [some number, e.g. 20] of the current value’. I was trying to implement this as ‘device attribute is < (variable - 20)’ where I put that same device attribute value into that variable sometime earlier. Thanks! Good luck.

1 Like

Hi @James, seems like this has been on the “hit list” for a while.
Any update?

For use cases I’d really like to be able to average out temps in a room as well as set controllable objects like bulbs and fans to calculated values.
As a suggestion and perhaps ease of implementation, you could look at how scratch implements basic math.



@JediBob, thanks for the follow up. I am currently working on another feature request that has more interests casted. But I agree, this variable math feature can be very helpful in many cases. So I will have to circle back on this one and let’s see if we can catch more votes here.

I keep running into situations where just simple math in variables - addition and subtraction - would be useful. For example, “three doors are unlocked”.

Wanted to see if a nudge would budge the “hit list” …


Just saw this new request for string conditions and figured I would share it here too in case anyone wants to vote on it since it seems like a relevant rule logic feature. Add string functions to flow conditions

1 Like

Would like to see this for things like displaying current crypto value. I can get the market value from an api call but then I want to see that times the number of coins that I own to see the current profit/loss.