-
Notifications
You must be signed in to change notification settings - Fork 88
[Bug]: localtuya is flooding the DB of events #517
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
Comments
The is an old issue #372 tho I haven't give it much attention yet so yes I would recommended to exclude it from recorder for now, this could happen if you have a sensors that update every seconds. |
For every new version I make the same modification:
If not "event" and "event_data" table of database grow by several gigabytes every day. This recording of events by "self._handle_event(self._status, status)" should definitively be an option disabled by default. |
this method handle the whole device not only one entity, Now the issue even If I give the user the option to turn it on it's still an issue it's still an issue and If HA doesn't give an option to filter it hard coded, then I'll need to create filter my self it's fine it's not big deal I'll look into it soon. |
Yes but I don't know the reason of these writes in "event" tables of database for every entities. In fact I don't know the use of "event" tables. For me it's completely useless. The only data I use come from the "state" and "statistics" tables of database. If I truncate these "event" tables nothing change, home assistant still running flawlessly without any difference. I imagine "event" tables have some use but I didn't see it. It's possible to choose what is recorded in "state" tables from recorder settings but these settings have no effect on event tables. So I only see "event" tables as a major flaw that cause my home assistant eat my memory and became unfunctionnal in just few weeks. |
I made some changes I was hopefully that there was a way to exclude events from HA recorder hard-coded. TBF, I'm not sure if it will fix this issue totally or not however I still recommend to exclude integration events from recorder in What I'm not sure of does home-assistant record the events that not being listen to? so I there is no listener for any of LT events or wildcard note: event: |
Even if excluded from recorder it's still recorded in "events" databases. According my tests exclude from recorder only act on "states" and "statistics" databases. All my local tuya measurements variables was excluded (to avoid flooding "states" database) and "events" is still flooded. All measurements data was processed and filtered by node red and only output variable from node red was allowed in recorder. None from local tuya. |
According to HA recorder docs it should do that, I would want to see how much it improved after the changes, if it's still an issue we can look more into it. |
This issue was closed because it was resolved on the release: 2025.3.0 |
Situation improved but I still generate 2 GB of data in event and event_data table in one week so I still need to comment this line:
I still didn't understand why it's needed to write the events. everything works well with this line commented out. |
I'll dig more into this later
Well commenting out this line disables the feature :) |
Ok but which feature ? Everything is still working perfectly. I still dont understand the purpose of these writes in DB. It's used for what ? |
I strongly believe the best is to add an option to not write in "events" table of databases at all. With the line "self.handle_events" commented out tables "events" is only 100 MB after one month compare to 2 GB / weeks. Everything in HA still working fine and I still have no idea about what is the purpose of these writing in database table. |
Hello friends, I'm also using another integration named Xiaomi Mito Auto to help me manage my MiHome devices. While browsing the ReadMe, I found they mentioned that
I haven't found any HA official announcement about It seems they did something similar to commenting out I'm not sure what feature will be influenced by commenting |
LocalTuya Version
2025.1.1
Home Assistant Version
2025.1.4 Docker
Environment
What happened?
Hello there,
I just reported on the HA community how LocalTuya is flooding the DB of events.
https://community.home-assistant.io/t/how-to-keep-your-recorder-database-size-under-control/295795/303?u=m4r1k
The events are described here: https://github.com/xZetsubou/hass-localtuya/blob/master/documentation/docs/ha_events.md?plain=1
But I think there should be a config on a per-device basis to record all this many events.
Also, I've seen an increase in the number of events from the 2025.1 version.
Steps to reproduce.
unclear
Relevant log output
Diagnostics information.
No response
The text was updated successfully, but these errors were encountered: