-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Warning: Integration accesses the database without the database executor #127
Comments
@Limych i got the Same warning in logs. |
same Problem for me |
Same upon upgrade to 2022.4.6
|
same for me. System Health
|
FYI: I've used this component with even debug level logging yesterday, and there weren't any warnings about this issue.
|
Logger: homeassistant.helpers.frame Detected integration that accesses the database without the database executor; Use homeassistant.components.recorder.get_instance(hass).async_add_executor_job() for faster database operations. Please report issue to the custom component author for average using this method at custom_components/average/sensor.py, line 477: history_list = history.state_changes_during_period( |
Accessing the database from the event loop will raise an exception in 2022.6 since it causes instability by blocking Home Assistant's event loop (which means it cannot do anything until the database call finishes): home-assistant/core#71547 It looks like https://github.com/Limych/ha-average/blob/dev/custom_components/average/sensor.py#L219 should not be decorated with https://github.com/Limych/ha-average/blob/dev/custom_components/average/sensor.py#L296 should be changed to |
@Limych did you see Nick's post above? |
@bdraco can you post the whole code snippets for those two functions? |
@bdraco Updating those lines caused a slew of errors when I "checked configuration". It did let me restart and after restart, sensor still inop |
Looks like it's sorted now. It could likely be optimized further by calling self.async_write_ha_state() in async_sensor_state_listener instead of scheduling another update unless there is a new to do another update but it should work just fine 👍 |
I just switched over to the average_linear in home assistant native
statistics and appears to be working about the same for me.
I've gone ahead and removed this custom component as it doesn't appear to
be being updated. Fwiw.
…On Tue, Apr 26, 2022, 1:21 PM ippo112 ***@***.***> wrote:
same for me.
------------------------------
System Health
version core-2022.4.7
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.108
arch x86_64
timezone Europe/Rome
—
Reply to this email directly, view it on GitHub
<#127 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVUGSXX45N2E3OSRDFC4O3VHAX2LANCNFSM5SXG34QQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Statistics sensor doc says: "The statistics sensor updates with every source sensor update." It's the same behavior as the filter sensors, that produces constant wrong values: off by 1 precision nearly all the time, see #26. :( Correct me if I'm wrong or things changed in HA in the past year. |
Environment
Describe the bug
With the latest HA update (2022.4.0) the warnings about writing to database related to "Average integration" started appearing in my log with instruction, to notify the author about it (see log below).
Configuration.yaml
Steps to Reproduce
Update to latest HA version
Expected behavior
Debug log
Additional context
The text was updated successfully, but these errors were encountered: