Beispiel #1
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Fedex platform."""
    import fedexdeliverymanager
    try:
        cookie = hass.config.path(COOKIE)
        session = fedexdeliverymanager.get_session(
            config.get(CONF_USERNAME), config.get(CONF_PASSWORD),
            cookie_path=cookie)
    except fedexdeliverymanager.FedexError:
        _LOGGER.exception("Could not connect to Fedex Delivery Manager")
        return False

    add_devices([FedexSensor(
        session, config.get(CONF_NAME), config.get(CONF_UPDATE_INTERVAL))])
Beispiel #2
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Fedex platform."""
    import fedexdeliverymanager
    name = config.get(CONF_NAME)
    update_interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL)

    try:
        cookie = hass.config.path(COOKIE)
        session = fedexdeliverymanager.get_session(config.get(CONF_USERNAME),
                                                   config.get(CONF_PASSWORD),
                                                   cookie_path=cookie)
    except fedexdeliverymanager.FedexError:
        _LOGGER.exception("Could not connect to Fedex Delivery Manager")
        return False

    add_entities([FedexSensor(session, name, update_interval)], True)
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Fedex platform."""
    import fedexdeliverymanager

    name = config.get(CONF_NAME)
    update_interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL)

    try:
        cookie = hass.config.path(COOKIE)
        session = fedexdeliverymanager.get_session(
            config.get(CONF_USERNAME), config.get(CONF_PASSWORD),
            cookie_path=cookie)
    except fedexdeliverymanager.FedexError:
        _LOGGER.exception("Could not connect to Fedex Delivery Manager")
        return False

    add_entities([FedexSensor(session, name, update_interval)], True)
Beispiel #4
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Fedex platform."""
    import fedexdeliverymanager

    _LOGGER.warning(
        "The fedex integration is deprecated and will be removed "
        "in Home Assistant 0.100.0. For more information see ADR-0004:"
        "https://github.com/home-assistant/architecture/blob/master/adr/0004-webscraping.md"
    )

    name = config.get(CONF_NAME)
    update_interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL)

    try:
        cookie = hass.config.path(COOKIE)
        session = fedexdeliverymanager.get_session(config.get(CONF_USERNAME),
                                                   config.get(CONF_PASSWORD),
                                                   cookie_path=cookie)
    except fedexdeliverymanager.FedexError:
        _LOGGER.exception("Could not connect to Fedex Delivery Manager")
        return False

    add_entities([FedexSensor(session, name, update_interval)], True)