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

[Bug]: Absurd ammount of registries on database #228

Open
3 tasks
pitiriguisvi opened this issue May 11, 2024 · 3 comments
Open
3 tasks

[Bug]: Absurd ammount of registries on database #228

pitiriguisvi opened this issue May 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@pitiriguisvi
Copy link

LocalTuya Version

3.2.5.1

Home Assistant Version

2024.5.2

Environment

  • Does the device work using the Home Assistant Tuya Cloud component?
  • Is this device connected to another local integration, including Home Assistant and any other tools?
  • The devices are within the same HA subnet, and they get discovered automatically when I add them

What happened?

I have an absurd ammount of registries in database with name:

  • localtuya_device_triggered: 145780 count event types
  • localtuya_states_update: 136691 count event types
  • localtuya_device_dp_triggered: 120756 count event types
    I have visualized the data with addon DbStats

Also, number of row in tables:

  • states: 877476
  • events: 408882

I have around 50 localtuya devices. 1.3GB of database. Fresh install 2 weeks ago.
image
image
image

Steps to reproduce.

  1. Install fresh HA.
  2. Connect my 50 devices to localtuya.
  3. Database starts increasing.

Relevant log output

Este error se originó a partir de una integración personalizada.

Registrador: homeassistant
Fuente: custom_components/localtuya/core/pytuya/__init__.py:610
integración: Local Tuya (documentación, problemas)
Ocurrió por primera vez: 13:27:24 (1 ocurrencias)
Último inicio de sesión: 13:27:24

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/locks.py", line 386, in acquire
    await fut
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/localtuya/common.py", line 457, in _async_refresh
    await self._interface.update_dps(cid=self._node_id)
  File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 1069, in update_dps
    await self.detect_available_dps(cid=cid)
  File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 1112, in detect_available_dps
    data = await self.status(cid=cid)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 1032, in status
    status: dict = await self.exchange(command=DP_QUERY, nodeID=cid)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 1006, in exchange
    msg = await self.dispatcher.wait_for(seqno, payload.cmd)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 610, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

Diagnostics information.

No response

@pitiriguisvi pitiriguisvi added the bug Something isn't working label May 11, 2024
@github-actions github-actions bot added the stale label May 26, 2024
Repository owner deleted a comment from github-actions bot May 26, 2024
@xZetsubou xZetsubou removed the stale label May 26, 2024
@xZetsubou
Copy link
Owner

These mass events is the results of the "temperature sensors" which updates every second or so? also each time it updates it also sent and event that a DP is triggered. I never thought that HA stores the events?

@pitiriguisvi
Copy link
Author

I have several temperature, humidity and CO2 sensors that update to the second, but also several Ampere, watts, etc sensors that also update very frequently.

  • It is possible that a sensor is updated every second, but then in the history only comes out information every 5 minutes (the average?).
  • How to prohibit HA to store the records that a PD has been triggered?

Thanks

@xZetsubou
Copy link
Owner

I just assumed that your sensor update every 1 seconds, but it short time for sure.
Before last update of this integration "2024.5.0" the integration was push the status every 5 seconds to entities, so double check with latest update if "states" updates too much.

Also check this: https://www.home-assistant.io/integrations/recorder/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants