ha-average icon indicating copy to clipboard operation
ha-average copied to clipboard

Weighted contribution

Open ACrazyConcept opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

Weighted contribution of sensors. E.g. if you have three sensors but for whatever reason you prefer that one sensor contributes 50% and the two other sensos only contribute 25% each to the average. Or any other combination.

Not a huge priority but if it doesn't require too much it would be pretty neat.

Describe alternatives you've considered

I can of course just create multiple average sensors or template sensors. But I already have too many.

Additional context

ACrazyConcept avatar Aug 06 '21 17:08 ACrazyConcept

Interesting idea. I'll try to add that ability.

Limych avatar Aug 26 '21 14:08 Limych

Not sure if this is related to this enhancement request or if I should submitted a new request. Please let me know if this needs to be submitted as a new feature request.

I have several light/lux sensors around my home and based on their location, they can return a wide range of values. As is, I believe this ha_average sensor would favor the sensors with the largest values and basically drown out the sensor that return small values. The solution to this problem could be handled by assigning a weight to each sensor in the average calculation, however during different parts of the day that weighting may no longer be applicable as the sun moves from one side of the house to the other. Another alternative maybe to "normalize" the data from each sensor, say between 0 - 1 so that each sensor contribution to the average calculation would be roughly equal. If I want to know the overall lightness or darkness for my entire home regardless of the time of day then I don't want one sensor to dominate as it could be that sensor just happens to pointed in a direction with direct sunlight.

In the graphs below, I have 2 different light sensors. The value in the top left corner of each graph is the actual sensor value, the middle number is the 15 minute average for that one sensor, the value in the top right corner is the 15 min average for all sensors. As you can see the red line that represents the overall average is dominated by the Living Room Sensor. It would be nice if there was an option to make contribution of each sensor roughly equal.

image

Thank you for creating this custom component. This is so much better and easier to use than the builtin Statistics component. I plan to make a Patreon contribution to help support it's further development.

andjones132 avatar Jul 01 '22 15:07 andjones132