legrego / homeassistant-elasticsearch

Publish Home-Assistant events to Elasticsearch
https://legrego.github.io/homeassistant-elasticsearch/
MIT License
143 stars 38 forks source link

Publishing All States doesn't fire if there are no state/attribute changes in the queue #291

Closed strawgate closed 2 weeks ago

strawgate commented 3 weeks ago

It appears as though we are checking whether we can publish and whether there are entries to publish before calling async_do_publish:

https://github.com/legrego/homeassistant-elasticsearch/blob/039e028accfbe334346c7087fc610280cce1ffee/custom_components/elasticsearch/es_doc_publisher.py#L451-L458

The problem is that scraping all entity states occurs within async_do_publish:

https://github.com/legrego/homeassistant-elasticsearch/blob/039e028accfbe334346c7087fc610280cce1ffee/custom_components/elasticsearch/es_doc_publisher.py#L196-L204 https://github.com/legrego/homeassistant-elasticsearch/blob/039e028accfbe334346c7087fc610280cce1ffee/custom_components/elasticsearch/es_doc_publisher.py#L221-L233

We should add a check to make sure that we still call async_do_publish if we are configured to publish all entities via polling.

This bug appears to have existed for quite a while (<0.6.0)