Math with variables?

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!

3 Likes

@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” …

2 Likes

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.

Bumping this. I want to create a rule that when humidity increases by 10% an exhaust fan is turned on.

2 Likes

i hope “bumping” helps. I’ve only been “nudging”…

3 Likes

Went to add two numbers together today and was surprised to find this was not an existing capability. Upvoting.

2 Likes

+1 from me. Would love this.

Any update on this feature request?

Also hoping for this. I want to be able to increase my thermostat’s set temperature if my pet’s enclosure gets too cold.

Thanks for sharing your use-case. It’s at the top of our hit list to revisit after we wrap up some of the Next Gen SmartThings work!

If it’s urgent, I have an approach that could work for you in the meantime. :wink:

1 Like

Fantastic, thank you!!
You have my interest haha. What’s the workaround you’re thinking of?

Side note, you have an awesome name!

SpiderManGIF

Sending you a PM. :slight_smile:

Mathematics in variables is great, I give +1
I could make a virtual electricity meter in the tile :), which would count the power consumption of the indicated devices :slight_smile:

1 Like

One big up vote on this from me, I am trying to replicate most of my WebCoRE pistons for Smartthings and I use ‘average’ of values in so many ways, and also sometimes simple “offset” like sunset -30 minutes for example, or -.5 degrees of the “cool set temp”… So far I’m really at a loss for reproducing my pistons, and it’s getting frustrating. Hubitat is looking better and better.

1 Like

When you create this, would you also look at calculating time difference, including across midnight.

I currently have some webcore pistons that calculate how long before a morning alarm will go off. I use this for a disabled family member.
I use virtual switches as trigger and alarm.
Happy to providewebcore pistons and SharpTools rule numbers if you want more detail.

Yes, a PM with examples would be helpful. Time related functions would likely be a separate feature request – especially considering we don’t have a formal time construct at the moment. See the recent Rules / Variables based on Date or Calendar thread for more discussion on the topic.