From ead00e956f758a73b86b384c23ee0abbd7f2f0fd Mon Sep 17 00:00:00 2001 From: Johan Bloemberg Date: Thu, 30 Mar 2017 07:50:32 +0200 Subject: [PATCH] Handle initial event after entity is instantiated. (#6760) --- homeassistant/components/light/rflink.py | 4 ++-- homeassistant/components/sensor/rflink.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/light/rflink.py b/homeassistant/components/light/rflink.py index ad25ae6a38d..a36a4f43f22 100644 --- a/homeassistant/components/light/rflink.py +++ b/homeassistant/components/light/rflink.py @@ -162,8 +162,8 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): hass.data[DATA_ENTITY_LOOKUP][ EVENT_KEY_COMMAND][device_id].append(device) - # Make sure the event is processed by the new entity - device.handle_event(event) + # Schedule task to process event after entity is created + hass.async_add_job(device.handle_event, event) hass.data[DATA_DEVICE_REGISTER][EVENT_KEY_COMMAND] = add_new_device diff --git a/homeassistant/components/sensor/rflink.py b/homeassistant/components/sensor/rflink.py index 8f8ae769d0e..80a5b7dfb8d 100644 --- a/homeassistant/components/sensor/rflink.py +++ b/homeassistant/components/sensor/rflink.py @@ -88,8 +88,8 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): hass.data[DATA_ENTITY_LOOKUP][ EVENT_KEY_SENSOR][device_id].append(device) - # Make sure the event is processed by the new entity - device.handle_event(event) + # Schedule task to process event after entity is created + hass.async_add_job(device.handle_event, event) hass.data[DATA_DEVICE_REGISTER][EVENT_KEY_SENSOR] = add_new_device