Example #1
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Wink binary sensor platform."""
    import pywink

    for sensor in pywink.get_sensors():
        if sensor.capability() in SENSOR_TYPES:
            add_devices([WinkBinarySensorDevice(sensor, hass)])

    for key in pywink.get_keys():
        add_devices([WinkBinarySensorDevice(key, hass)])

    for sensor in pywink.get_smoke_and_co_detectors():
        add_devices([WinkBinarySensorDevice(sensor, hass)])

    for hub in pywink.get_hubs():
        add_devices([WinkHub(hub, hass)])

    for remote in pywink.get_remotes():
        add_devices([WinkRemote(remote, hass)])

    for button in pywink.get_buttons():
        add_devices([WinkButton(button, hass)])

    for gang in pywink.get_gangs():
        add_devices([WinkGang(gang, hass)])
Example #2
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Wink platform."""
    import pywink

    for sensor in pywink.get_sensors():
        _id = sensor.object_id() + sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            if sensor.capability() in SENSOR_TYPES:
                add_entities([WinkSensorDevice(sensor, hass)])

    for eggtray in pywink.get_eggtrays():
        _id = eggtray.object_id() + eggtray.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_entities([WinkSensorDevice(eggtray, hass)])

    for tank in pywink.get_propane_tanks():
        _id = tank.object_id() + tank.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_entities([WinkSensorDevice(tank, hass)])

    for piggy_bank in pywink.get_piggy_banks():
        _id = piggy_bank.object_id() + piggy_bank.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            try:
                if piggy_bank.capability() in SENSOR_TYPES:
                    add_entities([WinkSensorDevice(piggy_bank, hass)])
            except AttributeError:
                _LOGGER.info("Device is not a sensor")
Example #3
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Wink platform."""

    for sensor in pywink.get_sensors():
        _id = sensor.object_id() + sensor.name()
        if (_id not in hass.data[DOMAIN]["unique_ids"]
                and sensor.capability() in SENSOR_TYPES):
            add_entities([WinkSensorEntity(sensor, hass)])

    for eggtray in pywink.get_eggtrays():
        _id = eggtray.object_id() + eggtray.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            add_entities([WinkSensorEntity(eggtray, hass)])

    for tank in pywink.get_propane_tanks():
        _id = tank.object_id() + tank.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            add_entities([WinkSensorEntity(tank, hass)])

    for piggy_bank in pywink.get_piggy_banks():
        _id = piggy_bank.object_id() + piggy_bank.name()
        if _id not in hass.data[DOMAIN]["unique_ids"]:
            try:
                if piggy_bank.capability() in SENSOR_TYPES:
                    add_entities([WinkSensorEntity(piggy_bank, hass)])
            except AttributeError:
                _LOGGER.info("Device is not a sensor")
Example #4
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Wink binary sensor platform."""
    import pywink

    for sensor in pywink.get_sensors():
        if sensor.capability() in SENSOR_TYPES:
            add_devices([WinkBinarySensorDevice(sensor)])

    for key in pywink.get_keys():
        add_devices([WinkBinarySensorDevice(key)])
Example #5
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Wink binary sensor platform."""
    import pywink

    for sensor in pywink.get_sensors():
        _id = sensor.object_id() + sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            if sensor.capability() in SENSOR_TYPES:
                add_devices([WinkBinarySensorDevice(sensor, hass)])

    for key in pywink.get_keys():
        _id = key.object_id() + key.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkBinarySensorDevice(key, hass)])

    for sensor in pywink.get_smoke_and_co_detectors():
        _id = sensor.object_id() + sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkSmokeDetector(sensor, hass)])

    for hub in pywink.get_hubs():
        _id = hub.object_id() + hub.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkHub(hub, hass)])

    for remote in pywink.get_remotes():
        _id = remote.object_id() + remote.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkRemote(remote, hass)])

    for button in pywink.get_buttons():
        _id = button.object_id() + button.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkButton(button, hass)])

    for gang in pywink.get_gangs():
        _id = gang.object_id() + gang.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkGang(gang, hass)])

    for door_bell_sensor in pywink.get_door_bells():
        _id = door_bell_sensor.object_id() + door_bell_sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkBinarySensorDevice(door_bell_sensor, hass)])

    for camera_sensor in pywink.get_cameras():
        _id = camera_sensor.object_id() + camera_sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            try:
                if camera_sensor.capability() in SENSOR_TYPES:
                    add_devices([WinkBinarySensorDevice(camera_sensor, hass)])
            except AttributeError:
                _LOGGER.info("Device isn't a sensor, skipping.")
Example #6
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Wink binary sensor platform."""
    import pywink

    for sensor in pywink.get_sensors():
        _id = sensor.object_id() + sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            if sensor.capability() in SENSOR_TYPES:
                add_devices([WinkBinarySensorDevice(sensor, hass)])

    for key in pywink.get_keys():
        _id = key.object_id() + key.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkBinarySensorDevice(key, hass)])

    for sensor in pywink.get_smoke_and_co_detectors():
        _id = sensor.object_id() + sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkSmokeDetector(sensor, hass)])

    for hub in pywink.get_hubs():
        _id = hub.object_id() + hub.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkHub(hub, hass)])

    for remote in pywink.get_remotes():
        _id = remote.object_id() + remote.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkRemote(remote, hass)])

    for button in pywink.get_buttons():
        _id = button.object_id() + button.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkButton(button, hass)])

    for gang in pywink.get_gangs():
        _id = gang.object_id() + gang.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkGang(gang, hass)])

    for door_bell_sensor in pywink.get_door_bells():
        _id = door_bell_sensor.object_id() + door_bell_sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            add_devices([WinkBinarySensorDevice(door_bell_sensor, hass)])

    for camera_sensor in pywink.get_cameras():
        _id = camera_sensor.object_id() + camera_sensor.name()
        if _id not in hass.data[DOMAIN]['unique_ids']:
            try:
                if camera_sensor.capability() in SENSOR_TYPES:
                    add_devices([WinkBinarySensorDevice(camera_sensor, hass)])
            except AttributeError:
                _LOGGER.info("Device isn't a sensor, skipping")
Example #7
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """ Sets up the Wink platform. """
    import pywink

    if discovery_info is None:
        token = config.get(CONF_ACCESS_TOKEN)

        if token is None:
            logging.getLogger(__name__).error(
                "Missing wink access_token - "
                "get one at https://winkbearertoken.appspot.com/")
            return

        pywink.set_bearer_token(token)

    add_devices(WinkSensorDevice(sensor) for sensor in pywink.get_sensors())
Example #8
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """ Sets up the Wink platform. """
    import pywink

    if discovery_info is None:
        token = config.get(CONF_ACCESS_TOKEN)

        if token is None:
            logging.getLogger(__name__).error(
                "Missing wink access_token - "
                "get one at https://winkbearertoken.appspot.com/")
            return

        pywink.set_bearer_token(token)

    add_devices(WinkSensorDevice(sensor) for sensor in pywink.get_sensors())
Example #9
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Wink platform."""
    import pywink

    for sensor in pywink.get_sensors():
        if sensor.capability() in SENSOR_TYPES:
            add_devices([WinkSensorDevice(sensor)])

    add_devices(WinkEggMinder(eggtray) for eggtray in pywink.get_eggtrays())

    for piggy_bank in pywink.get_piggy_banks():
        try:
            if piggy_bank.capability() in SENSOR_TYPES:
                add_devices([WinkSensorDevice(piggy_bank)])
        except AttributeError:
            logging.getLogger(__name__).error("Device is not a sensor")
Example #10
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Wink platform."""
    import pywink

    for sensor in pywink.get_sensors():
        if sensor.capability() in SENSOR_TYPES:
            add_devices([WinkSensorDevice(sensor, hass)])

    for eggtray in pywink.get_eggtrays():
        add_devices([WinkSensorDevice(eggtray, hass)])

    for piggy_bank in pywink.get_piggy_banks():
        try:
            if piggy_bank.capability() in SENSOR_TYPES:
                add_devices([WinkSensorDevice(piggy_bank, hass)])
        except AttributeError:
            logging.getLogger(__name__).info("Device is not a sensor")
Example #11
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Wink platform."""
    import pywink

    if discovery_info is None:
        token = config.get(CONF_ACCESS_TOKEN)

        if token is None:
            logging.getLogger(__name__).error(
                "Missing wink access_token. "
                "Get one at https://winkbearertoken.appspot.com/")
            return

        pywink.set_bearer_token(token)

    for sensor in pywink.get_sensors():
        if sensor.capability() in SENSOR_TYPES:
            add_devices([WinkBinarySensorDevice(sensor)])
Example #12
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Wink platform."""
    import pywink

    if discovery_info is None:
        token = config.get(CONF_ACCESS_TOKEN)

        if token is None:
            logging.getLogger(__name__).error(
                "Missing wink access_token. "
                "Get one at https://winkbearertoken.appspot.com/")
            return

        pywink.set_bearer_token(token)

    for sensor in pywink.get_sensors():
        if sensor.capability() in SENSOR_TYPES:
            add_devices([WinkBinarySensorDevice(sensor)])