Skip to content

cityssm/node-green-button-subscriber

Repository files navigation

Green Button® Subscriber for Node

npm (scoped) DeepSource Maintainability

Handles the OAuth authentication, downloading, and parsing of Green Button® data.

Important Notes

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.

Installation

npm install @cityssm/green-button-subscriber

Usage

⭐ 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()

Related Projects

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).

Trademarks

® 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.