Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, the integration seems to break in HA 23.3.1 #187

Closed
confucius78 opened this issue Mar 3, 2023 · 11 comments
Closed

Hi, the integration seems to break in HA 23.3.1 #187

confucius78 opened this issue Mar 3, 2023 · 11 comments
Labels
bug Something isn't working.

Comments

@confucius78
Copy link

Environment

  • Home Assistant Core release with the issue: 2023.03.1
  • This custom component release with the issue: Latest
  • Last working this custom component release (if known): current one was working until now
  • Operating environment (Home Assistant/Supervisor/Docker/venv): HA-OS

Describe the bug
All values seem to go way off due to some calculation error in the integration.
image

N/A
Add your configs here if any.

Steps to Reproduce
Just installed the HA 2023.03.1 update

Expected behavior
Kinda stating the obvious, but I'd expect a running average of my sensor that makes sense.

Debug log
To be uploaded

Add your logs here.


**Additional context**
N/A
@confucius78 confucius78 added the bug Something isn't working. label Mar 3, 2023
@sshalyminov
Copy link

sshalyminov commented Mar 3, 2023

Same for me
2023-03-03 155120
BTW min and max values of calculated average are exceed min and max of source. For example for this graph source min and max of source are 5 and 16 but min and max for "average" are 2.2 and 18.83

@sshalyminov
Copy link

sshalyminov commented Mar 3, 2023

2023-03-03 183924
blue line - original value, cyan line - calculated by this integration

@mwright-git
Copy link

Same here!

I'm going to switch to statistics platform as its causing me some major issues. Kept my heating on all night because it claimed the average of two indoor thermometers was -232C!

@MisfitPunisher
Copy link

Same here, almost all sensors become unavaialable.

@lmagyar
Copy link
Contributor

lmagyar commented Mar 6, 2023

This specific error seems to be an SqlAlchemy query cache bug (again), see: home-assistant/core#89224 and home-assistant/core#89170

Try to restart HA core a few times and there is a good chance to get rid of it until the next restart. Or not.

On the other hand:

@confucius78
Copy link
Author

Many thanks, I missed that post!

@lmagyar
Copy link
Contributor

lmagyar commented Mar 7, 2023

I've tried to test the PR in #89224 that fixes the query cache issue, but my system currently works without any issue, with or without the PR, even if I restart it 10 times, even if I restore a previous HA core and DB state.

If somebody wants to test the PR also, make sure:

  • you have core 2023.3.1 installed
  • you have SSH access to HA command line
  • you made a full backup

Then you can test it with the following commands:

docker exec -it homeassistant /bin/bash
cd /usr/src/homeassistant/
cp homeassistant/components/recorder/history.py /share/
cp homeassistant/components/recorder/statistics.py /share/
curl -L https://github.com/home-assistant/core/files/10903215/0001-pr89254.patch | git apply -v
exit
ha core restart

You should see something like this:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 20228  100 20228    0     0  16787      0  0:00:01  0:00:01 --:--:-- 63252
Checking patch homeassistant/components/recorder/history.py...
Checking patch homeassistant/components/recorder/statistics.py...
Hunk #2 succeeded at 645 (offset -4 lines).
Hunk #3 succeeded at 1254 (offset -4 lines).
Hunk #4 succeeded at 1267 (offset -4 lines).
Hunk #5 succeeded at 1280 (offset -4 lines).
Hunk #6 succeeded at 1322 (offset -4 lines).
Hunk #7 succeeded at 1739 (offset -4 lines).
Hunk #8 succeeded at 1918 (offset -4 lines).
Hunk #9 succeeded at 1983 (offset -4 lines).
Hunk #10 succeeded at 2035 (offset -4 lines).
Applied patch homeassistant/components/recorder/history.py cleanly.
Applied patch homeassistant/components/recorder/statistics.py cleanly.

If something really goes wrong you can copy back the python files from /share and restart HA core. Or restore a backup.

@lmagyar
Copy link
Contributor

lmagyar commented Mar 8, 2023

That fix is also in 2023.3.2. So no need for command line. :)

Please do some restarts after upgrading to 2023.3.2 to be sure, the problem really disappeared and do not resurface after a restart.

@PlayFaster
Copy link

Hi There

I'm still experiencing this issue in HA 2023.3.3. All Temperature Average sensors are unavailable on restart. Can be recovered after a few restarts OR seems to always recover after a full reboot of the HA RaspPi.

This only affects Temperature based Averages. All others (humidity, Lux, voltage, download speed) are not affected. They are available on every restart and do not seem to exhibit any strange value behaviour either.

I am seeing the warning pasted below in my HA Log, and I'm wondering if this is related to the issue?

WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses temperature utility. This is deprecated since 2022.10 and will stop working in Home Assistant 2023.4, it should be updated to use unit_conversion.TemperatureConverter instead. Please report issue to the custom integration author for average using this method at custom_components/average/sensor.py, line 258: temperature = convert_temperature(float(temperature), entity_unit, ha_unit)

@lmagyar
Copy link
Contributor

lmagyar commented Mar 13, 2023

The database related issue is fixed in sqlalchemy and will be part of 2023.3.4, fingers crossed home-assistant/core#89489 (comment)

The deprecation problem I think will never be fixed in this integration. :( I've moved on and replaced it with the built-in sensors. An idea in case of temperature averages: https://community.home-assistant.io/t/average-sensor/111674/153

@PlayFaster
Copy link

Hi Imagyar

Thanks for this. I have this week also made the move to the built-in-sesnors. The Average integration certainly has it's advantages, especially when it comes to averaging several sensors over time, but it definately has it's issues as well!

Thanks

@Limych Limych closed this as completed Oct 1, 2023
Limych pushed a commit that referenced this issue May 8, 2024
Update black requirement from ~=24.3 to ~=24.4
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

7 participants