From 6ed68d8ced66c2c91e82f6881c7e954c2035dd5a Mon Sep 17 00:00:00 2001 From: Igor Date: Sun, 31 May 2020 20:58:02 +0300 Subject: [PATCH] Do not show graphite warnings if no new_state in event (#36292) It is not correct to show warning about "unexpected event type" if EVENT_STATE_CHANGED have no new_state field. We should show this warning only if it is real unexpected event type. Run task_done() before continue, because we should tell the queue that the processing on the task is complete after get(). --- homeassistant/components/graphite/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/graphite/__init__.py b/homeassistant/components/graphite/__init__.py index 00dabd59d8f..327e8293be7 100644 --- a/homeassistant/components/graphite/__init__.py +++ b/homeassistant/components/graphite/__init__.py @@ -139,7 +139,16 @@ class GraphiteFeeder(threading.Thread): _LOGGER.debug("Event processing thread stopped") self._queue.task_done() return - if event.event_type == EVENT_STATE_CHANGED and event.data.get("new_state"): + if event.event_type == EVENT_STATE_CHANGED: + if not event.data.get("new_state"): + _LOGGER.debug( + "Skipping %s without new_state for %s", + event.event_type, + event.data["entity_id"], + ) + self._queue.task_done() + continue + _LOGGER.debug( "Processing STATE_CHANGED event for %s", event.data["entity_id"] )