MSkeem / CellarTracker-for-Home-Assistant

Home Assistant Custom Component integration to CellarTracker
2 stars 0 forks source link

Problem with sensor size and recorder. #1

Closed PexJensen closed 9 months ago

PexJensen commented 9 months ago

There is a problem regarding the size of the sensors and HA.

Logger: homeassistant.components.recorder.db_schema Source: components/recorder/db_schema.py:583 Integration: Recorder (documentation, issues) First occurred: 07.57.53 (1682 occurrences) Last logged: 14.52.21 State attributes for sensor.ct_red exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored State attributes for sensor.ct_white exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored

MSkeem commented 9 months ago

There is a problem regarding the size of the sensors and HA.

Logger: homeassistant.components.recorder.db_schema Source: components/recorder/db_schema.py:583 Integration: Recorder (documentation, issues) First occurred: 07.57.53 (1682 occurrences) Last logged: 14.52.21 State attributes for sensor.ct_red exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored State attributes for sensor.ct_white exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored

It is clear, that it is the number of bottles you have, exceeds the number which can be contained in the attributes. I did not know there was a limit, and I need to figure out what to do. I guess the best solution is to offload the attributes and make local JSON or CSV files, where the wine details could be stored. This will require some rework from my side, which I will do when I find some time for it.

MSkeem commented 9 months ago

I've successfully offloaded the attributes and created local JSON files. These files can now be visualized via an HTML file and integrated using an iframe. However, I have reservations about this approach due to the iframe's limitation of only supporting either HTTP or HTTPS — not both. This poses a potential issue depending on how users connect to Home Assistant. I'm continuing to explore and refine the solution. If anyone has suggestions, they'd be greatly appreciated!

MSkeem commented 9 months ago

A quick-fix is to remove the entities from the recorder. To do that you must:

  1. Open your configuration.yaml file, usually located in the root directory of your Home Assistant installation.
  2. Add or modify the recorder section with the exclude configuration with the following:
    recorder:
     exclude:
       entities:
         - sensor.ct_fortified
         - sensor.ct_other
         - sensor.ct_red
         - sensor.ct_rose
         - sensor.ct_sparkling
         - sensor.ct_white
  3. Save the changes.
  4. Restart Home Assistant for the changes to take effect.
MSkeem commented 9 months ago

Closed with workaround: https://github.com/MSkeem/CellarTracker-for-Home-Assistant/issues/1#issuecomment-1732227635

PexJensen commented 9 months ago

Will try that.

Thanks