Less steps for Variable Math possible?

I'm not sure if this is me seeking rule making advice or a feature request for more robust variable math, or something else, but I was wondering if anyone knows of a more efficient way to accomplish what I'm doing in this rule. All I want is for a virtual humidity sensor to be the average of 2 real humidity sensors, but it seems like a ton of steps to do it:

3 things that would be nice:

  1. If you could do multiple "variable math" operations on 1 line (so rather rather than having to create 'C' you could just set the variable to (A+B)/2;
  2. if you could set the device attribute to variable math rather than having to create a variable to store the value and then sending that value to the device (i.e. combine the last 2 lines of this rule);
  3. if variable math included an average function.

Probably want to use a groovy app for that. I was going to suggest another app that I use for temp, that could probably be modified fairly easy, but looks like someone already did something.

I have not tried this one but the explanation would do what you want.

Looks like that code is no longer available, try this one.

https://raw.githubusercontent.com/Gassgs/Hubitat-Apps-and-Drivers/master/Apps/Multi%20Sensor%20Plus/Multi%20Sensor%20Plus%20Parent%20app.groovy

[UPDATED] - Average All (Temperature, Humidity, Illuminance, Ambient Pressure & Motion)

This one in the Hubitat Groovy code examples should do what you need or at least a very good base.

1 Like

My app will handle making the virtual device and computing the average for you. Plus, some other goodies you may find useful.

4 Likes

Average all is still available on my website for a while

https://cobra-apps.co.uk

All my other apps are on there too :slight_smile:

3 Likes

The link times out and doesn't open for me.

The website seems down at the moment.

This one needs a child app that I can't seem to find.

Oh, let's throw in a request for more string operations!

This is the correct link for the whole app, with the doc.

Download the Hubitat app