Disane87 / spoolman-homeassistant

Spoolman home assistant integration 🏠
MIT License
59 stars 4 forks source link

General thoughts on amount of entities #40

Closed rufinus closed 1 year ago

rufinus commented 1 year ago

Checklist

Is your feature request related to a problem? Please describe.

Not really a FR.. but dont fit your categories :)

Looks really intresting, I have a already big HomeAssistant Instance, as I understand the setup each Spool is its own entity. Its updated by calls to the API of spoolman (as no events exists yet). So have you ever tested the performance with a lot of spools? Say 150?

I have currently around 200 spools managed in spoolman, having the reminder if one spool runs out is quite nice. But - only if there is no spool of that filament is left. The whole info of the spool is nice in HA - if you have a use case for it. but thats, in my case, 200 entities which get updated at an interval - where the info is not needed most of the time.

I thought about an integration which only is used for alarming/notifications. like if the last spool of filament A is used invoke an notification event. if the spool of filament B is near empty (like your threshold) and no other spool of this filament is present invoke notification event.

I could do that with some scripting magic and your integration - but i really fear the slow down of so many "passive" updated entities.

Whats your thoughts about this?

Describe the solution you'd like

...

Describe alternatives you've considered

...

Additional context

...

Disane87 commented 1 year ago

Thanks for the issue @rufinus!

Unfortunately I have never tried this with so many spools. But I think that should be irrelevant from HomeAssistant's point of view. You could of course think about removing all entities from this integration from the recorder if you fear performance problems. You don't really want to do long term analysis with it and, if you do, HA would be the wrong tool in my opinion. In this case, a time-series database is more suitable, which is intended for such purposes.

Even if there are many changes, the update interval of the API in the settings still comes into play here, which is currently at 15 minutes and thus changes would only be queried every 15 minutes at all.

You can read more about the recorder config here: https://www.home-assistant.io/integrations/recorder/#configure-filter

An approach which could be testes (if you encounter performance problems) would be this:

# Example filter to include specified domains and exclude specified entities
recorder:
    entity_globs:
      - binary_sensor.*_xyz

But you can try it of course. If you delete the integration later, there shouldn't be any zombie entities. Hope this help :)

I will tranfer this to an discussion, since it's not directly a bug or feature request.