def setup_platform(hass, config, add_entities, discovery_info=None):
    'Set up the BOM sensor.'
    station = config.get(CONF_STATION)
    (zone_id, wmo_id) = (config.get(CONF_ZONE_ID), config.get(CONF_WMO_ID))
    if (station is not None):
        if (zone_id and wmo_id):
            _LOGGER.warning('Using config %s, not %s and %s for BOM sensor', CONF_STATION, CONF_ZONE_ID, CONF_WMO_ID)
    elif (zone_id and wmo_id):
        station = '{}.{}'.format(zone_id, wmo_id)
    else:
        station = closest_station(config.get(CONF_LATITUDE), config.get(CONF_LONGITUDE), hass.config.config_dir)
        if (station is None):
            _LOGGER.error('Could not get BOM weather station from lat/lon')
            return
    bom_data = BOMCurrentData(station)
    try:
        bom_data.update()
    except ValueError as err:
        _LOGGER.error('Received error from BOM Current: %s', err)
        return
    add_entities([BOMCurrentSensor(bom_data, variable, config.get(CONF_NAME)) for variable in config[CONF_MONITORED_CONDITIONS]])
Set up the BOM sensor.
def setup_platform(hass, config, add_entities, discovery_info=None):
    
    station = config.get(CONF_STATION)
    (zone_id, wmo_id) = (config.get(CONF_ZONE_ID), config.get(CONF_WMO_ID))
    if (station is not None):
        if (zone_id and wmo_id):
            _LOGGER.warning('Using config %s, not %s and %s for BOM sensor', CONF_STATION, CONF_ZONE_ID, CONF_WMO_ID)
    elif (zone_id and wmo_id):
        station = '{}.{}'.format(zone_id, wmo_id)
    else:
        station = closest_station(config.get(CONF_LATITUDE), config.get(CONF_LONGITUDE), hass.config.config_dir)
        if (station is None):
            _LOGGER.error('Could not get BOM weather station from lat/lon')
            return
    bom_data = BOMCurrentData(station)
    try:
        bom_data.update()
    except ValueError as err:
        _LOGGER.error('Received error from BOM Current: %s', err)
        return
    add_entities([BOMCurrentSensor(bom_data, variable, config.get(CONF_NAME)) for variable in config[CONF_MONITORED_CONDITIONS]])