Ensure event listener integrations do the queue insert as a callback (#42265)
parent
5dac3883b0
commit
5bba299e8f
|
@ -26,6 +26,7 @@ from homeassistant.const import (
|
|||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import event as event_helper, state as state_helper
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_values import EntityValues
|
||||
|
@ -500,6 +501,7 @@ class InfluxThread(threading.Thread):
|
|||
self.shutdown = False
|
||||
hass.bus.listen(EVENT_STATE_CHANGED, self._event_listener)
|
||||
|
||||
@callback
|
||||
def _event_listener(self, event):
|
||||
"""Listen for new messages on the bus and queue them for Influx."""
|
||||
item = (time.monotonic(), event)
|
||||
|
|
|
@ -21,6 +21,7 @@ from homeassistant.const import (
|
|||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import state as state_helper
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -165,6 +166,7 @@ class WatsonIOTThread(threading.Thread):
|
|||
self.shutdown = False
|
||||
hass.bus.listen(EVENT_STATE_CHANGED, self._event_listener)
|
||||
|
||||
@callback
|
||||
def _event_listener(self, event):
|
||||
"""Listen for new messages on the bus and queue them for Watson IoT."""
|
||||
item = (time.monotonic(), event)
|
||||
|
|
|
@ -22,6 +22,7 @@ from homeassistant.const import (
|
|||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import event as event_helper, state as state_helper
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entityfilter import (
|
||||
|
@ -186,6 +187,7 @@ class ZabbixThread(threading.Thread):
|
|||
self.queue.put(None)
|
||||
self.join()
|
||||
|
||||
@callback
|
||||
def _event_listener(self, event):
|
||||
"""Listen for new messages on the bus and queue them for Zabbix."""
|
||||
item = (time.monotonic(), event)
|
||||
|
|
Loading…
Reference in New Issue