def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    import hikvision.api
    from hikvision.error import HikvisionError, MissingParamError

    host = config.get(CONF_HOST, None)
    port = config.get('port', "80")
    name = config.get('name', "Hikvision Camera Motion Detection")
    username = config.get(CONF_USERNAME, "admin")
    password = config.get(CONF_PASSWORD, "12345")

    try:
        hikvision_cam = hikvision.api.CreateDevice(
            host, port=port, username=username,
            password=password, is_https=False)
    except MissingParamError as param_err:
        _LOGGING.error("Missing required param: %s", param_err)
        return False
    except HikvisionError as conn_err:
        _LOGGING.error("Unable to connect: %s", conn_err)
        return False

    add_devices_callback([
        HikvisionMotionSwitch(name, hikvision_cam)
    ])
Setup Hikvision camera.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/switch/hikvisioncam.py/setup_platform