this takes every running quarter xx:00 / xx:15 / xx:30 / xx:45 unitl now timestamp.
So when the next quarter is reached it starts over again in it’s average calculation.
Im not the best with configurations in yaml so I will explain what I need and hopefully someone can help.
Here is my current config
sensor:
platform: average
name: ‘Average Temperature Day’
duration:
days: 7
entities:
sensor.openweathermap_temperature
platform: average
name: ‘Average Temperature Night’
duration:
days: 7
entities:
sensor.openweathermap_temperature
What I would like is a 7 day average of both day and night temperatures. I was thinking day time to be 6am untll 6pm and night time to be 6pm until 6am. Would it be possible to do this and if so what would the config be?
I have been using the Average Sensor for a while now without issue.
Recently I found a new usage for it, but am having trouble.
The issue is, that I would like to use an average over three Days. However, the base sensor should be read every day at 23:59 so that it has the complete daily consumption.
I recently started using this component, but it does not behave like I assume it should. I have successfully setup a sensor and restarted HA. Everything works as expected now, but when I do a “Quick Reload” in “Settings → System” the sensor becomes und stays unavailable. Once I do a “Restart Home Assistant” (also in Settings → System) the sensor comes back and works as expected.
I enabled debug logging and during the time the sensor is unavailable, I see successful updates on regular intervals in the logs. Noting point to an error there.
I am running Home Assistant: 2023.11.0
This is my config:
sensor:
- platform: average
name: 'Living Zone Temperature'
unique_id: temperature_avg_living_zone_cd13009b
entities:
- sensor.atc_f3c7_temperature
- sensor.atc_6ae8_temperature
- sensor.atc_a166_temperature
- sensor.atc_7347_temperature
and this is the log during the time the sensor is unavailable:
I just noticed some entities not graphing since I did the 2023.11 update. Having looked I found the culprit to be 4 “Average” platform sensors in my config file. I read the post above from sweetpotatobeef and thought a Restart would solve. It’s refusing to restart with 4 errors being
Platform error sensor.average - No module named 'homeassistant.util.temperature'
Googling I found that homeassistant.util.temperature was deprecated a year ago so probably was removed in the 2023.11 release.
Anyone else with this problem?
Is it going to get fixed?
A great additional feature (or did I just miss it?) would be to also consider the last_seen attribute of sensors. So it should be options like “ignore sensor if last update is older than timespan” (timespan being e.g. 1h) and “ignore value of sensors older than timespan compared to newest available sensor value”.
This would cover sensors that just don’t update timely sometimes by just ignoring them until they catch up to a more current reading.
I’m using the average sensor to become the average outside temperature at the end of each day.
But I could not find what sampling rate is used. How regularly are you taking a measure?
I may be wrong, but for a correct average it’s important to take a measure example each 1 second. After 24 hours you will have a sum of 86.400 measures. Or a sum of 1.440 measures when taking a sample each minute.
What is the sampling rate you are using?
This is my configuration
sensor:
- platform: average
name: Gemiddelde dagtemperatuur tuin
unique_id: Gemiddelde_dagtemperatuur_tuin
entities:
- sensor.temp_tuin #ends today at 00:00, last 24 hours.
end: ‘{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}’
duration:
hours: 24
I’m unable to install this from HACS, I get an “unspecified error” when attempting to download.
For a manual install, do I just need the average folder that it’s inside the ha-average-2.3.1/custom_components folder in the ZIP, or do I follow the Manual Installation instructions on GitHub and place the entire contents of ha-average-2.3.1/ into /config/custom-components/average? If so, I’ll end up with /config/custom_components/average/ha-average-2.3.1/custom_components/average which seems off to me.
I stumbled over Average Sensor while searching for a solution that gives me a averaged hourly value. The input sensor is household power consuption (not energy), which is one reading every minute.
The following setting averages power per hour, but I’m one hour of as a conesequence
I am trying to come up with a way to implement the average sensor for a specific use case: I would like to know the average duration a specific switch is turned on.
So, if a switch is on for 10 minutes, then the next day it’s turned on for 5 minutes, and later that same day it is turned on for 8 minutes, I would like this “averaged” sensor to be (10+5+8) / 3 = 7.66 minutes. Note that I do not want to take into account how long the switch has been off, so it does not matter if it has been days between times it was used or not.
Is there any way I can implement this with ha-average?
If you do your SQL query against the ‘statistics’ or ‘statistics_short_term’ database, then it also takes time into account and should be equally accurate.
I am looking for a real aggregation option. I actually want to save only one value per period (e.g. calendar day) from the average to reduce data and be able to access finished aggregated values immediately. The average sensor calculates the average, but still generates a lot of individual values, almost continuously. On the current day, the sensor would have to continually overwrite the old value until the period ends. Then a new individual value is generated.
I have three “average” sensors in my Configuration.yaml
‘AußentemperaturAverageDaily’ is working fine.
‘WP_LastAverageEver’ is not even displayed in the entities overview.
‘WP_LastAverageDaily’ is found in the entities overview but with a “Unavailable” remark.
Has anyone an idea why only one of the three is working?
The sensor “sensor.heat_generator_1_current_capacity_specification_compressorture” itself is also working fine.
It is a percentage. Maybe this is playing a role?
The pools temp can decrease due to cooling down and increase normally only with heatpump.
To calculate my heatpumps COP I need to sum up all increasing temp data as long the heatpump is running. And to calculate the yearly COP I want to sum up the increasing temp data over the whole year.
But doing this with e.g. statistics sensor (change) will also sum up all the small jumps up and down, which is wrong.
Any idea who I can solve this (e.g. with filters and if yes with what kind of them)?