Handles the OAuth authentication, downloading, and parsing of Green Button® data.
This code is for use with the Green Button Connect My Data® (CMD) standard. Before it can be used with your utility company, you may have to undergo a registration and approval process with that utility company to be formerly registered as a third party solution provider.
❗ Due to the extensive registration process and the need to be a customer with the utility company to access data, this module is currently only tested with UtilityAPI's Green Button® CMD implementation.
npm install @cityssm/green-button-subscriber
⭐ All output is parsed and returned as a fully typed object. ⭐
import { GreenButtonSubscriber } from '@cityssm/green-button-subscriber'
const configuration = {
baseUrl: 'https://greenbutton.example.com/',
accessToken: '0123456789abcdef'
}
// Pass the base URL, client ID, client secret, etc.
const greenButtonSubscriber = new GreenButtonSubscriber(configuration)
// Get the authorizations
const greenButtonResponse = await greenButtonSubscriber.getAuthorizations()
If you are looking to parse Green Button® XML data downloaded from a utility provider using the Green Button Download My Data® (DMD) standard, see the City of Sault Ste. Marie's Green Button® Parser.
If you are looking for a full application to report on energy usage, see EMILE (Energy Monitoring in Less Effort).
® GREEN BUTTON is a registered trademark owned by Departments of the U.S. Government.
The City of Sault Ste. Marie is a Liaison member of the Green Button Alliance.