fairecasoimeme / Zlinky_TIC

Téléinformation Linky autoalimenté ZigBee 3.0
290 stars 21 forks source link

HomeAssistant - base de données remplie à cause d'extra_states_attributes #174

Open helepeut opened 1 year ago

helepeut commented 1 year ago

Bonjour,

Je vous écris car j'ai actuellement un soucis en cours de résolution avec bdraco, qui travaille sur la partie MariaDB de HomeAssistant. Depuis quelques temps, j'ai d'énormes lenteurs dans la purge des données d'historique.

En regardant de plus prêt, il semblerait qu'il y ait un soucis avec la quantité de données remontées par le ZLinky_TIC (possiblement en mode PRODUCTION).

bdraco me demande de contacter le développeur de l'intégration - je ne sais pas si c'est à vous que je dois m'adresser, de ce fait j'ai aussi laissé un message à l'équipe Zigbee2MQTT que j'utilise pour remonter les données du ZLinky_TIC. En espérant que cela puisse faire avancer la science !

Le message de bdraco est le suivant :

_Please send a note to the dev that develops that integration

https://developers.home-assistant.io/docs/core/entity#generic-properties

DANGER Entities that generate a significant amount of state changes can quickly increase the size of the database when the extra_state_attributes also change frequently. Minimize the number of extra_stateattributes for these entities by removing non-critical attributes or creating additional sensor entities.

Le thread concernant le problème en question : https://github.com/home-assistant/core/issues/87352 La discussion ouverte avec Z2M : https://github.com/Koenkk/zigbee2mqtt/discussions/16549

fairecasoimeme commented 1 year ago

@vk496 did you see this issue. What do you think ?

vk496 commented 1 year ago

yes, this is a well-known issue. That's why I created a kind of "filters" to not expose attributes that doesn't make sense with your current tarif. My advice for this issue:

The first two points can be replaced with disabling the entities from Home Assistant (I would personally do both, just in case)

helepeut commented 1 year ago

Thanks ! This is more or less what I did early January when I saw the quantity of messages and attributes that were surfacing. So I decided to just keep the 2 attributes I wanted for my Production Linky (using the whitelist). But the database was already filled with these data, and I can't purge it in reasonable time. Bdraco used this database to update the db optimizer (I guess for a next release), and he just pointed me this warning in order to send it back to you. It might be worth adding this warning in the documentation ?

BrunoSpy commented 1 year ago

I don't know if I understood everything so forgive me if my question is silly : I think the issue is with the amount of attributes attached to each sensor. Why do we have this for each sensor : image

ellmout commented 11 months ago

Hello @BrunoSpy, In Z2M, in Settings, Home Assistant Integration, disable "Home Assistant legacy entity attributes". When enable :

  # Optional: Home Assistant legacy entity attributes, (default: shown below), when enabled:
  # Zigbee2MQTT will send additional states as attributes with each entity. For example,
  # A temperature & humidity sensor will have 2 entities for the temperature and
  # humidity, with this setting enabled both entities will also have
  # an temperature and humidity attribute.
BrunoSpy commented 11 months ago

Thank you. That was well hidden :)