The government has announced it will pay a rate to households and communities that produce electricity from renewable sources.