jrfuda
Active Member
Guys, I need a script that will look at three HomeSeer device values take their average, and post the result to a 4th device. For example:
Device: Value
Y1: 75
Y21: 73
Y41: 74
In this case, the average of the three values is 74, therefore, the script would assign this value to a designated device, Y56
Y56: 74
This is the basic functionality I need. It would be even better, however, if the script was smart enough to throw out an obviously bad number and use the other numbers to perform the average instead. For example:
Y1: 75
Y21: 0
Y41: 74
In this case, the script would ignore the 0 for device Y21 and just take the average of Y1 and Y41, resulting in 75 (rounding up).
Currently, I want to use this script to average the temperatiure values for 3 weather stations deliverd by the HS Plugin, WeatherPlug. The three weather stations I moniotr withthe plugin are within 66 miles of my home, but sometimes their temperatures differ by as much as 5 degrees. I currently use the temperature reading from the nearest station to trigger the enabling/disabling of heating and cooling events in HomeSeer (Outside temp below a certain point puts the house in heat mode, and above a certain point in cool mode). I'd rather use the average of the three stations for the trigger, and maybe even add a fourth device - the current temp that WeatherXML delivers - into the "average" value.
I supopse this could be used to average other things too - average house temp, if you have multiple temp sensors in the house, etc.
Anyone got something?
Device: Value
Y1: 75
Y21: 73
Y41: 74
In this case, the average of the three values is 74, therefore, the script would assign this value to a designated device, Y56
Y56: 74
This is the basic functionality I need. It would be even better, however, if the script was smart enough to throw out an obviously bad number and use the other numbers to perform the average instead. For example:
Y1: 75
Y21: 0
Y41: 74
In this case, the script would ignore the 0 for device Y21 and just take the average of Y1 and Y41, resulting in 75 (rounding up).
Currently, I want to use this script to average the temperatiure values for 3 weather stations deliverd by the HS Plugin, WeatherPlug. The three weather stations I moniotr withthe plugin are within 66 miles of my home, but sometimes their temperatures differ by as much as 5 degrees. I currently use the temperature reading from the nearest station to trigger the enabling/disabling of heating and cooling events in HomeSeer (Outside temp below a certain point puts the house in heat mode, and above a certain point in cool mode). I'd rather use the average of the three stations for the trigger, and maybe even add a fourth device - the current temp that WeatherXML delivers - into the "average" value.
I supopse this could be used to average other things too - average house temp, if you have multiple temp sensors in the house, etc.
Anyone got something?