def setup_platform(hass, config, add_entities, discovery_info=None):
    """Find and return Edimax Smart Plugs."""
    host = config.get(CONF_HOST)
    auth = (config.get(CONF_USERNAME), config.get(CONF_PASSWORD))
    name = config.get(CONF_NAME)

    add_entities([SmartPlugSwitch(SmartPlug(host, auth), name)], True)
Exemple #2
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Find and return Edimax Smart Plugs."""
    from pyedimax.smartplug import SmartPlug

    host = config.get(CONF_HOST)
    auth = (config.get(CONF_USERNAME), config.get(CONF_PASSWORD))
    name = config.get(CONF_NAME)

    add_devices([SmartPlugSwitch(SmartPlug(host, auth), name)])
def setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Find and return Edimax Smart Plugs."""
    host = config.get(CONF_HOST)
    auth = (config.get(CONF_USERNAME), config.get(CONF_PASSWORD))
    name = config.get(CONF_NAME)

    add_entities([SmartPlugSwitch(SmartPlug(host, auth), name)], True)
Exemple #4
0
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    """Find and return Edimax Smart Plugs."""
    from pyedimax.smartplug import SmartPlug

    # pylint: disable=global-statement
    # check for required values in configuration file
    if not validate_config({DOMAIN: config}, {DOMAIN: [CONF_HOST]}, _LOGGER):
        return False

    host = config.get(CONF_HOST)
    auth = (config.get(CONF_USERNAME, DEFAULT_USERNAME),
            config.get(CONF_PASSWORD, DEFAULT_PASSWORD))
    name = config.get(CONF_NAME, DEVICE_DEFAULT_NAME)

    add_devices_callback([SmartPlugSwitch(SmartPlug(host, auth), name)])