Average Sensor

UPD: Average Temperature sensor is now deprecated. Use Average sensor instead: https://github.com/Limych/ha-average


This sensor allows you to calculate the average temperature for one or more sensors over a specified period. Or just the average current temperature for one or more sensors, if you do not need historical data.

What makes this sensor different from others built into HA:

Compare with the min-max sensor.
This sensor in the mean mode produces exactly the same average value from several sensors. But, unlike our sensor, it cannot receive the current temperature data from a weather, climate and water heater entities.

Compare with statistics sensor.
This sensor copes with the averaging of data over a certain period of time. However… 1) it cannot work with several sources at once (and can’t receive temperature from weather, climate and water heater entities, like min-max sensor), 2) when calculating the average, it does not take into account how much time the temperature value was kept, 3) it has a limit on the number of values ​​it averages - if by chance there are more values, they will be dropped.

7 Likes

Why not the standard min/max sensor?

Because min/max sensor not allow to calculate average temperature for, as example, last 24 hours. Unfortunately, the filter sensor also does not allow this, as it turned out…

Thanks for the explanation.
Could you post a use case for this sensor as it’s not that straightforward to find it on your Github…

Doesn’t the Statistics Sensor do this?

1 Like

Example from my HA configs:

# Example configuration.yaml entry
sensor:
  - platform: average_temperature
    duration:
      days: 2
    entites:
      - sensor.gismeteo_temperature

I’m not sure that this sensor can correctly calculate the average temperature value. My sensor takes into account not only the temperature values, but also the time how much each value held.

Can this sensor do an instant calculation as well? I currently use a template sensor, but I prefer how you can list each entity rather than me having to go sensor + sensor + sensor /3

What do you mean by “instant calculation”?
Calculation of average temperature for the current values of several sensors? Yes, it can. Use configs like that:

# Example configuration.yaml entry
sensor:
  - platform: average_temperature
    entites:
      - sensor.gismeteo_temperature
      - sensor.owm_temperature
      - sensor.dark_sky_temperature

Thanks for the example.
When I say use case, it’s a bit more than just a code.
Could you explain me the reason behind having a sensor that has a value of average temperature in the last 2 days? :wink:

Really it’s up to the end user how they want to use things and requires a bit of imagination, but my thoughts are that you can use it to signify the start of warm or cool months. Here’s some that come into mind:

  • 5 day running average outside temperature above X degrees, it’s time to move the rabbit hutch into the shade.
  • 5 day running average outside temperature above/below X degrees, time to open the vents on your air conditioner/heater.
  • Long term climate control and energy management. Average temperature in your house is X degrees - this is warmer than it needs to be and you could consider lowering your heater.
3 Likes

Now I just testing the sensor - I wrote it a little more than a day ago.

Where I live, it is customary to change car tires twice a year for winter and summer tires. As a lazy person, I do not want to suffer every time the question of exactly how to do it. So I want to make a sensor that will remind me. :wink:

Absolutely. Just wanted to know how exactly the author uses his sensor(s) as there was a reason to create it, not just an vague need for something “different”…
Your thoughts are great, especially the first and the last ones… :wink:

So you have an automation that reminds you when the average temperature is above/below a certain level, or it’s something else?

Yes, I plan to have that automation, but No, I have not that automation for now — I just testing sensor… :slight_smile:

New version released. Now you able to use weather provider entities as a data sources.

An update has been released taking into account the new rules for the integration of components in Home Assistant versions 0.92+.

Unfortunately, updating through the custom-updater may not work. In this case, you need to update the component manually. In the future, automatic update will work again correctly.

What makes this sensor different from others built into HA:

Compare with the min-max sensor.
This sensor in the mean mode produces exactly the same average value from several sensors. But, unlike our sensor, it cannot receive the initial temperature data from a weather object.

Compare with statistics sensor.
This sensor copes with the averaging of data over a certain period of time. However … 1) it cannot work with several sources at once (and can’t receive temperature from weather object, like min-max sensor), 2) when calculating the average, it does not take into account how much time the temperature value was kept, 3) it has a limit on the number of values ​​it averages - if by chance there are more values, they will be dropped.

I can add to this sensor ability to receive temperature data from other objects, like it receive data from weather object. Climate object, as example. Does it need to anybody?

I thought we just fill in the entities section with entities and that’s it, what else is needed to receive data?