Handle initial event after entity is instantiated. (#6760)

This commit is contained in:
Johan Bloemberg 2017-03-30 07:50:32 +02:00 committed by Paulus Schoutsen
parent 556dba4020
commit ead00e956f
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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