From 87c138c5593ae7c9c7e4b1a20858c96d5a9f6b82 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sat, 25 Jun 2016 19:25:59 +0200 Subject: [PATCH] Third batch of (minor) fixes as suggested by @balloob --- homeassistant/components/homematic.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/homematic.py b/homeassistant/components/homematic.py index 6662c6bbe0d..040a15a368e 100644 --- a/homeassistant/components/homematic.py +++ b/homeassistant/components/homematic.py @@ -22,6 +22,7 @@ from homeassistant.const import EVENT_HOMEASSISTANT_STOP, \ ATTR_DISCOVERED, \ STATE_UNKNOWN from homeassistant.loader import get_component +from homeassistant.helpers import discovery from homeassistant.helpers.entity import Entity import homeassistant.bootstrap @@ -150,25 +151,11 @@ def system_callback_handler(hass, config, src, *args): # they are setup in HA and an event is fired if found_devices: component = get_component(component_name) - config = {component.DOMAIN: found_devices} - # Ensure component is loaded - homeassistant.bootstrap.setup_component( - hass, - component.DOMAIN, - config) - - # Fire discovery event - hass.bus.fire( - EVENT_PLATFORM_DISCOVERED, { - ATTR_SERVICE: discovery_type, - ATTR_DISCOVERED: { - ATTR_DISCOVER_DEVICES: - found_devices, - ATTR_DISCOVER_CONFIG: '' - } - } - ) + # HA discovery event + discovery.load_platform(hass, component, DOMAIN, { + ATTR_DISCOVER_DEVICES: found_devices + }, config) for dev in devices_not_created: if dev in HOMEMATIC_DEVICES: