Average Sensor

It is up to you. I just give the instrument. It all depends on what you want to get in the end.

Is there a way to use 2 sensor instances, like this?:

sensor:
  - platform: average
    name: 'Downstairs average temperature'
    entities:
      - sensor.lumi_lumi_weather_ad594404_temperature
      - sensor.lumi_lumi_weather_12114a04_temperature
      - sensor.lumi_lumi_weather_9315f103_temperature
      - sensor.lumi_lumi_weather_a6014a04_temperature
sensor:
  - platform: average
    name: 'Upstairs average temperature'
    entities:
      - sensor.lumi_lumi_weather_28344b04_temperature
      - sensor.lumi_lumi_weather_41624404_temperature

It worked briefly, maybe 2 days, then only displays the ā€˜Upstairs average temperatureā€™

There is no average platform for sensor (maybe a custom component?) Are you sure this worked?

See here:

this custom component allows creating average sensors .

My badā€¦ didnā€™t read from the beginning :neutral_face:

average
Sure did, now itā€™s just the Upstairs average temperatureā€¦

I donā€™t quite get what is the problem and what exactly worked briefly?

If you look at the code there are 2 separate sensor instances. One upstairs (red on the graph), one for downstairs (green on the graph). Both showed up for a day, now only the upstairs.

Where?
I take you posted a Lovelace card of one of them - do you expect both on one card?

Apparently we have some differences with our vocabularies. The red (upstairs temperature) and green (downstairs temperature) values displayed at the same intervals, for roughly 2 days. Then the downstairs average temperature disappeared from the graph and I am unable to see it again.

You CANT have 2 sensor sectionsā€¦

sensor:
|
|
sensor:

That is INVALID

sensor:
  - platform: average
    name: 'Downstairs average temperature'
    entities:
      - sensor.lumi_lumi_weather_ad594404_temperature
      - sensor.lumi_lumi_weather_12114a04_temperature
      - sensor.lumi_lumi_weather_9315f103_temperature
      - sensor.lumi_lumi_weather_a6014a04_temperature
  - platform: average
    name: 'Upstairs average temperature'
    entities:
      - sensor.lumi_lumi_weather_28344b04_temperature
      - sensor.lumi_lumi_weather_41624404_temperature

That is valid and should work. I have multiple average sensors configured

1 Like

I appreciate your help, David. But why the heck did it work for a few days then quit? Now I see that it should have never operated properly and I did not change anything in configuration.yaml, and yes it is working properly now.

Yep

You must have.

Iā€™d have to agree with @DavidFW1960 something may have changed even somewhere elseā€¦ an error in parsing the yaml above or below your sensor could have somehow oddly made it work temporarilyā€¦ but once something was changed (possibly anywhere in your config) it now picked up both sensor: lines and started ignoring one of themā€¦ possibly an error in yaml just above the first sensors: caused it to ignore the first one thinking it was part of the yaml aboveā€¦ Iā€™ve done something similar myself.

So, I must be doing something wrong. I have created the sensor, it has data and I have added it to my history component.

Here is my config under my sensor folder:

- platform: average
  name: 'Average Temperature BR temp'
  duration: 15
  entities:
    - sensor.br_temp

Sensor history graph card and config:
image

entities:
  - sensor.br_temp
  - sensor.average_temperature_br_temp
  - sensor.br_hum
refresh_interval: 60
show_header_toggle: false
title: Bathroom ESP
type: history-graph

And yes, the sensor is created:

So, why when it is added to the history card do I not even see it listed in the header and why do I not see data? I would like it to establish a rolling average of the room temp over the time period of the card.

I should add that a history card with only that entry looks like this:
image

I assume that I am misunderstanding something about the operation of this sensor.
Thanks Matt

I found an errorā€¦ had one to many spaces between the dash and the sensor name in the history component.

Now I see the dataā€¦

My question is as followsā€¦ I am trying to keep a rolling average of this data point that should yield a smoothā€™ish curve. I am trying to figure out what interval to generate the data pointā€¦ Should I go for minutes? do I need to set it up for 24 hours? I am not sure I understand the data gathering and reporting part of this.

I am or was expecting a median line that runs through the graphā€¦ how does one get there?

Itā€™s simple: the sensor averages the data over your chosen range. The more you set a measure window for it, the smoother the line will be. For example, to calculate the average temperature outside, I use data for three days.

I think, for the smoothness of your line, it is reasonable to set the range so that inside it there are about three temperature peaks. Judging by the schedule in your picture, you have air conditioning. One peak you have is about 1 hour 45 minutes. So the range of 5 hours will capture about 3 peaks.
Try the following settings:

- platform: average
  name: 'Average Temperature BR temp'
  duration:
    hours: 5
  entities:
    - sensor.br_temp

Update to .107 broke it :slight_smile:

Hereā€™s my configuration.yaml portion :

  - platform: average
    name: 'Average downstairs temperature'
    entities:
      - sensor.lumi_lumi_weather_ad594404_temperature 
      - sensor.lumi_lumi_weather_12114a04_temperature
      - sensor.lumi_lumi_weather_9315f103_temperature
      - sensor.lumi_lumi_weather_a6014a04_temperature
  - platform: average
    name: 'Average upstairs temperature'
    entities:
      - sensor.lumi_lumi_weather_41624404_temperature
      - sensor.lumi_lumi_weather_145c4404_temperature

Downstairs is fine with no obvious issues, and upstairs was working until about an hour ago, and 3 HA restarts, then 2 reboots. Where can I put the units of measurement?

Use customize for the entity. All the day/time names changed.

Popped up again this morning. Didnā€™t change a thing however.