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:

2 Likes

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.

2 Likes

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,

2 Likes

Upvoting this per my thread in the Beta forum: https://community.sharptools.io/t/beta-context-variables-variables-in-notifications/5290/21?u=tagyoureit

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.

Thx!

1 Like

@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.