def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the ISY994 platform."""
    # pylint: disable=protected-access
    logger = logging.getLogger(__name__)
    devs = []
    # Verify connection
    if ISY is None or not ISY.connected:
        logger.error('A connection has not been made to the ISY controller.')
        return False

    # Import weather
    if ISY.climate is not None:
        for prop in ISY.climate._id2name:
            if prop is not None:
                prefix = HIDDEN_STRING \
                    if prop in DEFAULT_HIDDEN_WEATHER else ''
                node = WeatherPseudoNode('ISY.weather.' + prop, prefix + prop,
                                         getattr(ISY.climate, prop),
                                         getattr(ISY.climate, prop + '_units'))
                devs.append(ISYSensorDevice(node))

    # Import sensor nodes
    for (path, node) in ISY.nodes:
        if SENSOR_STRING in node.name:
            if HIDDEN_STRING in path:
                node.name += HIDDEN_STRING
            devs.append(ISYSensorDevice(node, [STATE_ON, STATE_OFF]))

    # Import sensor programs
    for (folder_name, states) in (
            ('HA.locations', [STATE_HOME, STATE_NOT_HOME]),
            ('HA.sensors', [STATE_OPEN, STATE_CLOSED]),
            ('HA.states', [STATE_ON, STATE_OFF])):
        try:
            folder = ISY.programs['My Programs'][folder_name]
        except __HOLE__:
            # folder does not exist
            pass
        else:
            for _, _, node_id in folder.children:
                node = folder[node_id].leaf
                devs.append(ISYSensorDevice(node, states))

    add_devices(devs)
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/sensor/isy994.py/setup_platform