예제 #1
0
async def _setup_platform(hass, *devices):
    """Set up the SmartThings light platform and prerequisites."""
    hass.config.components.add(DOMAIN)
    broker = DeviceBroker(hass, devices, '')
    config_entry = ConfigEntry("1", DOMAIN, "Test", {}, SOURCE_USER,
                               CONN_CLASS_CLOUD_PUSH)
    hass.data[DOMAIN] = {DATA_BROKERS: {config_entry.entry_id: broker}}
    await hass.config_entries.async_forward_entry_setup(config_entry, 'light')
    await hass.async_block_till_done()
    return config_entry
예제 #2
0
async def setup_platform(hass, platform: str, *, devices=None, scenes=None):
    """Set up the SmartThings platform and prerequisites."""
    hass.config.components.add(DOMAIN)
    config_entry = ConfigEntry(2, DOMAIN, "Test",
                               {CONF_INSTALLED_APP_ID: str(uuid4())},
                               SOURCE_USER, CONN_CLASS_CLOUD_PUSH)
    broker = DeviceBroker(hass, config_entry, Mock(), Mock(), devices or [],
                          scenes or [])

    hass.data[DOMAIN] = {DATA_BROKERS: {config_entry.entry_id: broker}}
    await hass.config_entries.async_forward_entry_setup(config_entry, platform)
    await hass.async_block_till_done()
    return config_entry