Protect hm thread for hangs on events (#4717)

This commit is contained in:
Pascal Vizeli 2016-12-04 15:31:24 +01:00 committed by GitHub
parent 4d35f2805f
commit b5c2be8ffa

View File

@ -544,19 +544,19 @@ def _hm_event_handler(hass, proxy, device, caller, attribute, value):
# keypress event # keypress event
if attribute in HM_PRESS_EVENTS: if attribute in HM_PRESS_EVENTS:
hass.bus.fire(EVENT_KEYPRESS, { hass.add_job(hass.bus.async_fire(EVENT_KEYPRESS, {
ATTR_NAME: hmdevice.NAME, ATTR_NAME: hmdevice.NAME,
ATTR_PARAM: attribute, ATTR_PARAM: attribute,
ATTR_CHANNEL: channel ATTR_CHANNEL: channel
}) }))
return return
# impulse event # impulse event
if attribute in HM_IMPULSE_EVENTS: if attribute in HM_IMPULSE_EVENTS:
hass.bus.fire(EVENT_KEYPRESS, { hass.add_job(hass.bus.async_fire(EVENT_KEYPRESS, {
ATTR_NAME: hmdevice.NAME, ATTR_NAME: hmdevice.NAME,
ATTR_CHANNEL: channel ATTR_CHANNEL: channel
}) }))
return return
_LOGGER.warning("Event is unknown and not forwarded to HA") _LOGGER.warning("Event is unknown and not forwarded to HA")